开发者

Run cron Tasks at Midnight on Heroku

开发者 https://www.devze.com 2023-03-09 03:55 出处:网络
I have created my cron task to run every day at 00:00. However, I don\'t understand how this works. I haveif Time.now.hour == 0 in my cron.rake but I don\'t understand if I need to setup the cron:da

I have created my cron task to run every day at 00:00. However, I don't understand how this works.

I have if Time.now.hour == 0 in my cron.rake but I don't understand if I need to setup the cron:daily addon at midnight?

Anyone care to expl开发者_开发百科ain?

Thanks


Heroku's cron:daily addon will only run the cron rake task every day at the time you activate the addon. So the condition in your rake task won't do anything. Just deactivate the cron addon, wait until midnight and then turn it on (probably via command line would be easiest). It's a little annoying that you have to do it this way, but that's what their docs say.

http://devcenter.heroku.com/articles/cron#frequently-asked-questions - Scroll to the bottom.

0

精彩评论

暂无评论...
验证码 换一张
取 消