cron job not executing

Posted on

Problem :

I have a cron job that is supposed to run a script every 15 minutes.

*/15 * * * * /path/to/script.sh

I checked in three hours later and found that the script never ran, even once.

Earlier I tried to get it to run every half hour by:

0, 30 * * * * /path/to/script.sh

with the same (lack of) results.

Yes, the script is executable by me and I’m using my own crontab. Any ideas?


Update:

Here is what I tried so far:

  1. Tested cron by writing a script to echo helloworld, wrote a crontab to run it every minute and waited around for 15 minutes while nothing happened.
  2. Looked for cron.allow and cron.deny. cron.allow does not exist, cron.deny does but I am not in it.
  3. Looked for the cron logs as was suggested. Don’t have read priveleges, will write to request them.

Solution :

You may want to go deeper. First of all make sure your cron daemon is actually running. (On some distros it doesn’t by default.)

Then take a look at the daemon with strace. Does it actually read the file?

If it does, is there a way to set the logging level to debug? Does the cron daemon try to execute the script? If yes, what’s the return code?

If it doesn’t, where does it look for cron files? Is your user allowed to create crontabs? Is the file in the directory the crond is looking in?

Leave a Reply

Your email address will not be published. Required fields are marked *