Bug 445079 - delay.cron can fail
Summary: delay.cron can fail
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: crontabs
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Marcela Mašláňová
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-05-03 09:57 UTC by Dolhay Denes
Modified: 2008-05-05 10:06 UTC (History)
0 users

(edit)
Clone Of:
(edit)
Last Closed: 2008-05-05 10:06:46 UTC


Attachments (Terms of Use)

Description Dolhay Denes 2008-05-03 09:57:24 UTC
Description of problem:

The bilt in delay.cron can give back "./000-delay.cron: line 13: [: x0: integer
expression expected" if $DELAY has a "0" value.

Suggestion: add one more checks for that too.

Result:

[ -f /etc/sysconfig/crontab ] && . /etc/sysconfig/crontab
if [ ! -z "$DELAY" ]; then
    if [ "x$DELAY" != "x0" ]; then
        # Create md5sum of hostname (static over system lifetime)
        md5sum="`echo ${HOSTNAME} | md5sum`"

        # Extract the first 3 hexdigits (12 Bit: 0-4095)
        hexvalue="${md5sum:0:3}"

        # Create decimal value
        decvalue="`printf "%d" "0x${hexvalue}"`"

        # Divide delay by factor
        T_DELAY=$[ ${decvalue} / ${DELAY} ]
        sleep $T_DELAY
    fi
fi
exit 0


Note You need to log in before you can comment on or make changes to this bug.