Bug 445079 - delay.cron can fail
delay.cron can fail
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: crontabs (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Marcela Mašláňová
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-05-03 05:57 EDT by Dolhay Denes
Modified: 2008-05-05 06:06 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-05 06:06:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Dolhay Denes 2008-05-03 05:57:24 EDT
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.