Tag Archives: cron

Debugging Cron tasks /Crontab

Debugging Cron tasks /Crontab

1. Check the contents of crontab

 crontab -e

2. Check the permissions of script/directory locations being referred in the crontab.

3. Ensure the appropriate users are configured for crontab

vi /etc/cron.deny

vi /etc/cron.allow

4. Is the crond running?

service crond status

5. Confirm there are no exceptions/messages

sudo tail -f /var/log/cron

sudo tail -f /var/log/messages

6. sudo cat /etc/pam.d/crond

Expected output :

auth       sufficient pam_env.so

auth       required   pam_rootok.so

auth       include    system-auth

account    required   pam_access.so

account    include    system-auth

session    required   pam_loginuid.so

session    include    system-auth

7. Ensure there are no unread status mails for you sent by crond –
cat /var/spool/mail/nraj
Following the above steps, helped me debug the error in my crontab which was that I had an extra * (6 parameters instead of the required 5) while defining the frequency of the cron script…DUH!!!

Reference: https://forums.oracle.com/forums/thread.jspa?threadID=2209522&start=15&tstart=0