"Whenever" gem running cron jobs on Heroku

AdamT picture AdamT · Dec 23, 2011 · Viewed 18.4k times · Source

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

Answer

Will picture Will · Dec 23, 2011

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.