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'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?

share|improve this question
    
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
add comment

1 Answer

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.

share|improve this answer
add comment

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.