Run cron Tasks at Midnight on Heroku
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.
精彩评论