Crontab: Not executing properly

cronfreebsd

(OS is FreeBSD 8.1)

Yesterday I added 2 lines to crontab as root:

0 7 * * * curl --silent http://username:pass@dev.mydomain.tld/cron/execute/process/verbose/true >>/home/www/dev_mydomain_tld/logs/cron_process.log 2>&1
0 8 * * * curl --silent http://username:pass@dev.mydomain.tld/cron/execute/process/verbose/true >>/home/www/dev_mydomain_tld/logs/cron_process.log 2>&1

Doing the command right from shell as root works just fine. It just do some stuff, and send out some emails. The second run shouldn't send any emails, this is handled by the script. Thus the second line is only for my testing pleasure, making sure that a second run don't send out the same emails.

This morning I waited for the emails, at 7am and 8am – but nooo.

The cron log has the following to tell me

Feb  8 07:00:00 webserver /usr/sbin/cron[50878]: (root) CMD (   /usr/local/bin/bsdsar_gather)
Feb  8 07:00:00 webserver /usr/sbin/cron[50881]: (root) CMD (newsyslog)
Feb  8 07:00:00 webserver /usr/sbin/cron[50882]: (root) CMD (/usr/libexec/atrun)
Feb  8 07:00:00 webserver /usr/sbin/cron[50883]: (operator) CMD (/usr/libexec/save-entropy)
Feb  8 07:00:00 webserver /usr/sbin/cron[50886]: (root) CMD (curl --silent http://username:pass@dev.mydomain.tld/cron/execute/process/verbose/true >>/home/www/dev_mydomain_tld/logs/cron_process.log 2>&1)

[...]

Feb  8 08:00:00 webserver /usr/sbin/cron[51147]: (root) CMD (   /usr/local/bin/bsdsar_gather)
Feb  8 08:00:00 webserver /usr/sbin/cron[51149]: (root) CMD (newsyslog)
Feb  8 08:00:00 webserver /usr/sbin/cron[51150]: (operator) CMD (/usr/libexec/save-entropy)
Feb  8 08:00:00 webserver /usr/sbin/cron[51151]: (root) CMD (/usr/libexec/atrun)
Feb  8 08:00:00 webserver /usr/sbin/cron[51152]: (root) CMD (curl --silent http://username:pass@dev.mydomain.tld/cron/execute/process/verbose/true >>/home/www/dev_mydomain_tld/logs/cron_process.log 2>&1)

Also /home/www/dev_mydomain_tld/logs/cron_process.log showed no change, also no change in date. Running from shell updates it just fine.

Best Answer

Is curl in the path set by cron? You should either set your PATH in a script or use the full path to curl (ie /usr/local/bin/curl or similar).

Have a look at crontab(5) for the details about environnement variables.