I'm having trouble making cron work.

I edit my cron jobs doing

  1. sudo crontab -u myuser -e

  2. sudo crontab -u myuser -l prompts my cron tables:

    */1 * * * * /home/myuser/Projects/scripts/cron.sh
  3. /usr/lib/cron/cron.allow and .deny do not exist

  4. ps -A | grep cron && ps aux | grep 'cron' -n

    820 ?        00:00:00 cron
    63:root       820  0.0  0.0   2268   884 ?        Ss   17:09   0:00 cron

Yet the script is not executed. Am I missing something?

After the crontab -e it shows that it is saving to a temporary file. Is this a problem?

  • Is your script executable by "myuser"? – Chris Ting Jun 7 '11 at 21:47
  • It is (chmod 755) – Fisher Jun 7 '11 at 21:49
  • After all it is running. Changed the output directory of my test script and it is working. However, how can i run it with root priviligies? Should i just edit the root crontab by doing sudo crontab -e ? – Fisher Jun 7 '11 at 21:56
  • There are a few ways to get your script running with root privs. Using the root crontab is the easiest and most straight-forward. – Chris Ting Jun 7 '11 at 22:01

Cron check the crontabs every minute to look for changes, create your cron entry and be more patient. crontab's are saved in temporary file until they're read.

Why you're using sudo to modify crontab for another user? User without shell? Seems strange to execute an script in that environment.

My answer is basead in vixie's cron, always put version and branch of the software in that type of question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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