Sunday, December 13, 2009

Why does cron fail to run a job? what is cron EOF error?

The cronjobcommand works from the command prompt but from a crontab it doesnt seem to be getting invoked at all.

First, check the error log for the cronjob

$* * * * * cronjobcommand 2> log

One of the problems could be cron EOF error.

esp if the cron command has % in the command (most of the cron commands have `date +%F` to log the output according to date)

Read the manpage for the crontab file (`man 5 crontab`) and pay
particular attention to the discussion of the "%" character. % needs to be escaped

wrong: $ 1 0 * * * /scripts/nmon.sh -F /scripts/log/NMON`date '+%d'`.nmon -t -s 300 -c 2880

correct: $ 1 0 * * * /scripts/nmon.sh -F /scripts/log/NMON`date '+\%d'`.nmon -t -s 300 -c 2880

No comments:

Post a Comment