Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1326  / 3 Years ago, thu, june 24, 2021, 6:23:14

I have simple script written in Ruby.




  • I'd like to run as a background task (daemon process or service).

  • What is more want to have control over it so that I can start and stop it.

  • It will be perfect if process can be started automatically when my VPS restarts.



Is there any way to do that?


More From » services

 Answers
7

Actually I found perfect solution for that. It requires upstart so is far more easier than standard services, runit and systemd.



Here is more detailed instruction:
http://blog.arkency.com/2014/06/create-run-and-manage-your-background-processes-with-upstart/



And it is something like:



In /etc/init/my_program_upstart_script.conf:



start on my_event
respawn
exec /home/my_user/my_program/my_program_executable


Yes, so simple!



Just run the program with sudo initctl emit my_event.


[#24382] Saturday, June 26, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
byishted

Total Points: 469
Total Questions: 113
Total Answers: 113

Location: Tajikistan
Member since Sun, Aug 29, 2021
3 Years ago
;