Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.
share|improve this question
    
Did you check the logs/email? Also, specify linux distribution/cron version. –  haimg Dec 23 '11 at 19:12
1  
Does crontab -l show the job correctly? –  slhck Dec 23 '11 at 19:21
    
possible duplicate of cron runs but nothing happens –  RedGrittyBrick Dec 23 '11 at 19:26
    
@RedGrittyBrick, No it isn't. I read that question first. He misnamed a file. I checked that already. –  Yitzchak Dec 23 '11 at 19:39
2  
@Yitzchak: OK. Did you try all the suggestions in the accepted answer? Do you have "cron.* -/var/log/cron" in /etc/syslog.conf? –  RedGrittyBrick Dec 23 '11 at 19:42

1 Answer 1

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?

share|improve this answer
    
Thanks for the answer! I haven't thought about this problem or needed to use cron in quite a while. Now I have to recreate the situation and learn a bit more about in depth troubleshooting –  Yitzchak Jun 23 '13 at 15:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.