Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Can anyone provide insight to why my cron jobs are not running? I has tried simple jobs, like a date/time job, and it works.

Below is an example of what I am trying to run:

# Begin Whenever generated tasks for: taxscribe
0 0,6,12,18 * * * /bin/bash -l -c 'cd /home/deploy/taxscribe/releases/20110311205859 && RAILS_ENV=production rake informer:sync:submitted --silent'

0 * * * * /bin/bash -l -c 'cd /home/deploy/taxscribe/releases/20110311205859 && RAILS_ENV=production rake informer:sync:extensions --silent'

0 * * * * /bin/bash -l -c 'cd /home/deploy/taxscribe/releases/20110311205859 && RAILS_ENV=production rake informer:sync:accounts --silent'

# End Whenever generated tasks for: taxscribe

Thanks for your help.

share|improve this question

migrated from stackoverflow.com Mar 21 '11 at 18:45

This question came from our site for professional and enthusiast programmers.

    
Is this in the per-user crontab or in the system-wide crontab? If it's the latter, then it needs a user field` before the command. –  Joachim Sauer Mar 21 '11 at 16:11
    
it is in the per-user under our deploy user –  Queencity13 Mar 21 '11 at 16:22
1  
Why are you running these in a subshell? They are already going to run in a subshell. This might be part of the problem. Remove the /bin/bash -l -c ' and the matching end quote, and add `SHELL=/bin/bash' to the top of the crontab. –  JeffG Mar 21 '11 at 19:16
add comment

4 Answers

maybe rake isn't in the PATH when crond attempts to execute the job? (try putting the full path to the rake binary)

share|improve this answer
    
when I run each job manually they run fine. –  Queencity13 Mar 23 '11 at 13:14
    
yep but when run from crond, the PATH might be different. Simply replace "rake" with "/full/path/to/rake" and see if it works. –  ggiroux Mar 23 '11 at 14:21
    
Thanks ggiroux...it looks like putting the full path in the job makes it work. –  Queencity13 Mar 24 '11 at 18:08
add comment

Ensure that crond is running

pgrep crond
share|improve this answer
    
crond is running b/c it provides me with the pid number –  Queencity13 Mar 21 '11 at 19:13
    
The cron daemon is not called crond on all systems. On my gentoo box it's just cron. pgrep cron would match both variants. –  MattBianco Mar 22 '11 at 9:20
add comment

Check to see if crond is running and also check to see that it is set to startup with the system

chkconfig crond --list

if it isn't then do

chkconfig crond on

to have have it start at boot.

Also check your logs. Ensure that there isn't an error in your scripts preventing execution.

/var/log/cron

share|improve this answer
    
I dont have a cron log –  Queencity13 Mar 23 '11 at 13:10
add comment

If the jobs that you are running produce any output then cron will have mailed that to the account that was running the job.

You could capture the output of the jobs to a log file e.g.

/bin/bash -l -c 'cd /home/deploy/taxscribe/releases/20110311205859 && RAILS_ENV=production rake informer:sync:submitted --silent &>/path/to/file.log'

and see what it has to say.

share|improve this answer
    
when i try to add the log file to the end of the job, i get permission denied when run them manually...I assume it has to do with being signed in as a deploy user –  Queencity13 Mar 23 '11 at 13:12
    
@Queencity13: change the /path/to/file.log to something that you can write to. –  Iain Mar 23 '11 at 13:19
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.