How can I stop Heroku Dyno that is running a Rails task through Heroku Scheduler?

最后都变了- 提交于 2019-12-08 19:22:59

问题


Heroku Scheduler uses a One-off Dyno to run the scheduled task. That dyno doesn't appear in Heroku Dashboard, but it's there. How can I restart it, or temporarily stop it?


回答1:


If you have the command line tools installed, heroku ps will list all the running processes, and you can use ps:kill or ps:restart to manage any of them.

heroku help ps will give you more details.




回答2:


You do not need to restart or stop. There are no dynos on Heroku dashboard, but you can find your scheduler in Heroku Scheduler dashboard.

You can set your schedulling tasks with running time you want and dyno plan.

When the time you set come, heroku scheduler dyno is started. After finishing the work, dyno is killed.

If you want to run manually, just call heroku run rake xxxx command.




回答3:


Find the ID of the scheduled task with:

heroku ps

It returns:

=== scheduler (Free): bundle exec rake myraketask (1)
scheduler.7114: up 2019/02/24 14:50:36 +1100 (~ 24m ago)

=== web (Free): bin/rails server -p $PORT -e $RAILS_ENV (1)
web.1: up 2019/02/24 14:58:53 +1100 (~ 16m ago)

In this case, scheduler.7114 is the scheduled task ID. Stop it with:

heroku ps:stop scheduler.7114


来源:https://stackoverflow.com/questions/38897701/how-can-i-stop-heroku-dyno-that-is-running-a-rails-task-through-heroku-scheduler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!