Possible Duplicate:
Reasons why crontab does not work

I have setup a crontab to run a shell script every minute. Here's my crontab file:

* * * * * sh /var/www/stuff/public_html/recycle.sh

This crontab fails to run at all, but if I run the shell script by itself it works perfect. Can anyone explain why this might be happening? Other potentially useful info:

  • OS: Ubuntu 10.04
  • User running the crontab: root

It could be a permissions issue?

Also - try adding in a email address to the script so that any output (errors etc.) is emailed to you.

You can do this by adding: MAILTO=someone@somewhere.com

EDIT: I see you are running as root, missed that before....

Is it possible that the script is using enrionment variables that root does not have? ie. instead of using 'python' you might want to use /bin/python (or whatever it is)


Look for email messages in the root email account.

maybe you really want

\* \* \* \* \* sh -c "/var/www/stuff/public_html/recycle.sh"

I think the whole "sh -c" is probably redundant, so just try it with the command /var/www.....

Better yet, capture the output, then you know it ran And you are capture stdout/stderr to a file for later inscepction.

\* \* \* \* \* sh /var/www/stuff/public_html/recycle.sh > /tmp/myProj/recycle_sh.trace_log 2>&1

Some crontabs understand a seperate line at the top like


I hope this helps.

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