Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Whenever" gem running cron jobs on Heroku

I created an app that uses the whenever gem. The gem creates cron jobs. I got it working locally but can't seem to get it working on heroku cedar. What's the command to do this?

running:

heroku run whenever --update-crontab job1 

doesn't work

like image 742
AdamT Avatar asked Dec 23 '11 19:12

AdamT


People also ask

Can heroku run cron jobs?

Cron To Go is an add-on created for Heroku users to run scheduled jobs based on one-off dynos using cron expressions. Cron To Go combines the simplicity of using cron to schedule jobs with the scale and elasticity of the cloud.

Is heroku scheduler reliable?

Reliable delivery Heroku Scheduler is a free add-on, but it doesn't guarantee that jobs will be executed at their scheduled time, or at all for that matter. While it is rare, the possibility that a job may be skipped or run twice does exist.


1 Answers

Short answer: use the scheduler add-on: http://addons.heroku.com/scheduler

Long answer: When you do heroku run, we

  1. spin up a dyno
  2. put your code on it
  3. execute your command, wait for it to finish
  4. throw the dyno away

Any changes you made to crontab would be immediately thrown away. Everything is ephemeral, you cannot edit files on heroku, just push new code.

like image 137
Will Avatar answered Sep 24 '22 11:09

Will