Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /home/myapp/current/script/
 0 3 * * * /home/myapp/current/script/

Hi, the first job gets run every 5 minutes, the other doesnt seem to be getting run (there is no log file, no email error, nothing). I have to be doing something dumb... any ideas? It runs fine on the command line.

Here is the shell script:

 cd /home/myapp/current;rake send_insurance_reminders RAILS_ENV=production >> /home/myapp/current/log/insurance_reminders.log

The log file hasnt been updated since the last time I ran it manually

share|improve this question
What do you see in /var/log/messages? /var/log/cron? Is there output there? Can you share the contents of the script? – ewwhite Aug 11 '11 at 19:49
nothing in either of those files, will update with contents of shell script – Joelio Aug 11 '11 at 19:59
seems with my provider cron messages go to /var/log/syslog, I see the normal running of the first job there, but no indication of the 2nd one running or failing. – Joelio Aug 11 '11 at 20:10
Did cron send any email to the OS user? Normally our system does and I can see why cron failed. While logged in to your system, type 'mail' at the command prompt. – Alvin Sim Aug 12 '11 at 5:21

What about changing the cron line to:

 0 3 * * * /bin/bash /home/myapp/current/script/
share|improve this answer

You are waiting until 3AM for it to run, right?

If so, does it depend on an environment variable that's set in your login shell?

share|improve this answer
I dont think so, but added the contents of the script above. – Joelio Aug 11 '11 at 20:12
You should add a shebang line (#!/bin/bash) to the top of your script. – MikeyB Aug 11 '11 at 20:14

Does the shell script have the proper Read and Execute permissions?

share|improve this answer
yes, it has the same permissions as the one thats running fine. – Joelio Aug 11 '11 at 20:11
Questions requesting further information should be added as comments to the OP. – Antoine Benkemoun Aug 12 '11 at 11:42

Cron will ignore an entry without a trailing newline - double-check that you have a newline (or two!) after the last entry.

share|improve this answer

How did you edit the crontab file?

Depending on your cron implementation, it may be not picking up changes to the crontab file if you edit it directly. If this is the case either edit the crontab file with crontab -e command or inform the cron process about the changes (see the manual page of your cron implementation on how to do this).

Many modern cron implementations notice changes automatically though. This may not be the right solution in your case but it is a possibility and I did not see it mentioned yet.

share|improve this answer

To assist with diagnosis, you could add logger statements to the beginning and end of your cron so that messages are sent to syslog:

logger -t fetchmail Mail Fetch Started; /home/myapp/current/script/ && logger -t fetchmail Mail Fetch Completed

The reason that you want an "&&" before the final message is so that if your script fails to execute, it'll never send the completed message to syslog.

I personally like to use tags (the -t) so it makes it easier to grep your syslog.

share|improve this answer

You haven't said explicitly that your script works. Assuming that it does, please ensure that the cron is running as you. If it isn't, ensure that the user running the cron has execute permissions to the script.

When troubleshooting crons, I also like to su to that user (usually using su - username) and execute the script manually.

share|improve this answer

Your Answer


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.