Tuesday, August 18, 2009

Cron Jobs Not Launching

We had an issue recently with cron jobs not firing on our Solaris 10 server. We finally tracked it down to cron not being initialised when the server rebooted. The error was in a file called /var/svc/log/system-cron:default.log and indicated that it couldn't find the user. Possibly due to NFS not being mounted.
sharfah@starship:~> tail -10 /var/svc/log/system-cron:default.log
[ Aug 16 00:01:25 Stopping because service disabled. ]
[ Aug 16 00:01:25 Executing stop method (:kill) ]
[ Aug 16 00:07:27 Enabled. ]
[ Aug 16 00:07:28 Executing start method ("/lib/svc/method/svc-cron") ]
[ Aug 16 00:07:28 Method "start" exited with status 0 ]
! No such user as sharfah - cron entries not created Sun Aug 16 00:07:28 2009
We then got the Unix SAs to restart svc:/system/cron:default:
sharfah@starship:~> tail -10 /var/svc/log/system-cron:default.log
[ Aug 18 17:25:19 Stopping because service restarting. ]
[ Aug 18 17:25:19 Executing stop method (:kill) ]
[ Aug 18 17:25:20 Executing start method ("/lib/svc/method/svc-cron") ]
[ Aug 18 17:25:20 Method "start" exited with status 0 ]
Another way to fix this issue, is to edit and resave crontab.

For debugging cron issues, a useful tip is to look at /var/mail/user which will contain any stdout or errors from your cron jobs.

Related post:
Percent Sign in Crontab

No comments:

Post a Comment