ScottJShea
ScottJShea

Reputation: 7111

Rails hourly cron jobs using Whenever fails to run hourly

On Redhat, using Whenever. My cron jobs fail to run hourly. I need help as to why.

Schedule.rb

every 1.hours do
  rake "deathburrito:all", :environment => "development"
  rake "bamboo:all", :environment => "development"
  rake "jira:grab_data", :environment => "development"
end

Crontab -l

0 * * * * /bin/bash -l -c 'cd /var/www/qadashboard && RAILS_ENV=production bundle exec rake deathburrito:all --silent'

0 * * * * /bin/bash -l -c 'cd /var/www/qadashboard && RAILS_ENV=development bundle exec rake bamboo:all --silent'

0 * * * * /bin/bash -l -c 'cd /var/www/qadashboard && RAILS_ENV=development bundle exec rake jira:grab_data --silent'

Can anyone help me? I am not even sure what else I should be checking.

Upvotes: 0

Views: 427

Answers (3)

Lavixu
Lavixu

Reputation: 1398

Append log to config/schedule.rb

set :output, "/var/log/cron"

and create this file 'cron' in /var/log and give it write permission.

Execute

  bundle exec whenever --update-crontab
  sudo /etc/init.d/cron restart

To see the logs:

tail -f /var/log/cron

will give you more insight on the error.

Upvotes: 1

Leonid Shevtsov
Leonid Shevtsov

Reputation: 14189

Add

[email protected]

to your crontab. Then enjoy the error reports from cron.

If that won't solve the issue, post the error report here.

Upvotes: 2

Marc B
Marc B

Reputation: 360842

bundle will have to be in that subshell's path. Try specifying a full-blown /usr/bin/bundle (or whatever it is).

Upvotes: 1

Related Questions