Heroku 上的 Cron 作业
根据 Heroku 文档:
Cron 作业根据启用附加组件的时间执行
但是,我在两天前晚上 8 点启用了 cron 附加组件,并且 cron 作业在昨晚 8 点没有运行。今天下午 3 点,我运行了“heroku cron”,工作顺利开始。
有人有这方面的经验吗?运行“heroku cron”是否意味着从现在开始它将在每天下午 3 点运行?我使用的是每日 cron 作业插件,而不是每小时插件。
谢谢, 齿轮。
According to the Heroku docs:
Cron jobs execute based on when you enable the add-on
However, I enabled the cron add on at 8pm two nights ago and the cron job did not run at 8pm last night. At 3pm today, I ran "heroku cron" and the job kicked off without any issue.
Does anyone have any experience with this? Does running "heroku cron" mean it will run at 3pm every day from now on? I am using the daily cron job add on and not the hourly addon.
Thanks,
gearoid.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过在 Web 界面上查看应用程序的 Cron 插件来了解 cron 作业的安排时间。
Heroku Backup Task gem 使使用 cron 作业自动备份变得非常容易。
Heroku 的本机自动备份插件现在处于内测阶段,因此希望它很快就会发布:http:// /devcenter.heroku.com/articles/pgbackups
You can see when your cron job is scheduled by looking at your app's Cron add-on on the web interface.
The Heroku Backup Task gem makes it really easy automatically back up with a cron job.
Heroku's native automatic backups add-on is in private beta now, so hopefully it'll be released soon: http://devcenter.heroku.com/articles/pgbackups
您不需要插件即可在 Heroku 上运行长期任务。
安装 gem
确保将 gem 包含在捆绑器中,或者以任何方式包含它。
然后,您需要创建一个名为
task_scheduler.rb
的文件,并将其粘贴到您的initializers
目录中。如果您遇到任何问题,可以查看此博客文章:
http://intridea.com/2009/2/13/dead-simple-task-scheduling-in-rails?blog=company
You do not need an addon to run chronic tasks on Heroku.
Install the gem
Make sure you include the gem in bundler or however you are including it.
Then you need to create a file called
task_scheduler.rb
and stick this in youinitializers
directory.If you have any trouble you can see this blog post:
http://intridea.com/2009/2/13/dead-simple-task-scheduling-in-rails?blog=company