Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If i close my terminal would a rake task started on Heroku continue to run

I have a script which in need to run on my data. I have made a rake task for that. If i start the rake task by using heroku run rake my_task:my_action and after a while my internet disconnects. What would happen. Will the task continue to run as it has been initiated on a remote machine. I think it will continue to run. Any ideas.

like image 448
AMBasra Avatar asked Feb 15 '13 12:02

AMBasra


People also ask

How do I stop heroku scheduler?

Stopping one-off dynos If you wish to stop a running one-off dyno, use heroku ps:stop with its name. A one-off dyno will not stop if you issue heroku ps:restart on your application.


3 Answers

Processes started in a one-off dyno (the kind of dyno that is provisioned with heroku run command) run attached to your local terminal and will terminate if your internet disconnects or you cancel the command locally.

To execute a process in a one-off dyno that is not attached to your local terminal, use heroku run:detached:

$ heroku run:detached bundle exec rake my_task:my_action
Running `bundle exec rake my_task:my_action` detached... up, run.7562
Use `heroku logs -p run.7562` to view the output.

To introspect whether the one-off dyno is still running use heroku ps. One-off dynos are named run.X where X is some number.

like image 70
Ryan Daigle Avatar answered Sep 23 '22 23:09

Ryan Daigle


Guys so after trying and exploring i have found that in normal circumstances it doesnt continue. When the terminal closes pipes breaks and it stops to continue.

like image 25
AMBasra Avatar answered Sep 22 '22 23:09

AMBasra


You can run your rake in screen to prevent your script/rake from breaking if you get disconnected.

http://www.gnu.org/software/screen/manual/screen.html

like image 41
Huy Avatar answered Sep 26 '22 23:09

Huy