1

I have an app hosted on Heroku and this app need to run some task several times per day, lets say 4 times (and in the best way - I would like to set up, which hour will be the task run - eg. 1. task at 1AM, 2. at 5AM, 3. at 11AM and 4. at 8PM).

Heroku offers the addon called Scheduler. Is there any way to run tasks by the time scheme above?

4

1 回答 1

2

You can run the scheduler hourly but you'd need to check what hour it currently is via;

[1,5,11,20].include?(Time.now.hour)

in the task that you want to run to have it run at 1am, 5am, 11am and 8pm as per your question.

于 2012-05-08T07:46:41.003 回答