Haseeb Ahmad
Haseeb Ahmad

Reputation: 8730

How to update crontab in heroku

I am using whenever gem for cronjobs. To update crontab locally I do

whenever --update-crontab

I want to know how to update cron-tab on heroku.

Another question is that I am using free-tier of heroku.Is paid account needed for that or not?

Upvotes: 0

Views: 319

Answers (1)

taglia
taglia

Reputation: 1847

You can't use the crontab on heroku, you have to use something like the Heroku Scheduler.

The reason why you can't use the crontab is that heroku uses an ephemeral file system. So, if you run a command to change the crontab (with heroku run whenever --update-crontab for example), heroku would start a dyno, change its crontab locally, then throw the dyno away. So your changes would not be persistent.

You can use the Heroku Scheduler with a free account, you just need to write your code as rake tasks, then add the corresponding rake commands in the scheduler config page.

Upvotes: 2

Related Questions