Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

I do "crontab -e" and add the following line:

0   9    *   *   *      /usr/bin/python /home/g1/g1/utils/ > /home/g1/log/statsemail.log

But it doesn't work! Why? The script itself works. Also, the log is empty.

My other command in crontab is this, and it works:

0   9    *   *   *      /usr/bin/python /home/g1/g1/sphinx/ > /home/g1/log/updateall.log
share|improve this question
My guess is that there is a bug in the script that makes some assumptions about the environment that is not true when it is being ran from cron. – Zoredache Jun 14 '10 at 21:53
But when I run this, it works: /usr/bin/python /home/g1/g1/utils/ – Alex Jun 14 '10 at 21:55
Did you check the email being sent to root? – Ignacio Vazquez-Abrams Jun 14 '10 at 22:05
Make sure permissions for the script and log are appropriate for whichever user's cron you're putting this in. – Cory J Jun 14 '10 at 23:47
up vote 6 down vote accepted

you can add MAILTO=youremail to the crontab to get detials of the failure and fix this.

EDIT: probably your cron cannot run your script because it is not permitted to do this

share|improve this answer

You are writing STDOUT to a logfile, but you should also pipe STDERR to the same logfile. Right now, you probably won't see any error messages generated by this script.

Your script may be failing due to something simple, like the user executing the cronjob doesn't have permission to execute the script. Also, remember that cron executes commands in a very simple environment, and may be very different then your regular interactive shell environment.

Change your script to this:

0   9    *   *   *      /usr/bin/python /home/g1/g1/sphinx/ > /home/g1/log/updateall.log 2>&1

What does updateall.log show you now?

Also, cron usually logs some information to a logfile. What does /var/log/cron.log say about your cronjob?

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.