Friday, September 3, 2010

Cron jobs

Cron jobs are the way of implementing scheduled jobs in Solaris (as with any Unix based system)

Below are some useful information on cron jobs. I am not mentioning the format of defining cron jobs. Just few commands and files related to cron jobs which are useful for trouble shooting.

crontab -l

 -> Displays the cronjobs defined for the user who invoked.
 -> crontab -l displays the cronjobs associated with the user

crontab -e
 ->Invokes the editor to edit the cronjobs for the invoking user.
 ->User's might have to export the EDITOR variable to properly open the editor

If crontab -l is not working, check who are the users who has cron jobs defined. This can be seen by root from the files in the below location
->/var/spool/cron/crontabs

Cron job logs are in /var/adm/cron -> Accessible to root and have entries defining the start and end of each jobs. Very usefull for trouble shooting.

check cron.allow and cron.deny files to see if the users has enough privilage to run cron job.
/etc/cron.d/cron.allow       
/etc/cron.d/cron.deny       

By default only root is allowed if cron.allow file is not available.

Check if the cron daemon is running or not.

No comments:

Post a Comment