Supervisor

Supervisor: A Process Control System

ref:http://supervisord.org/index.html

Install

$ sudo apt install supervisor

sample.conf

ref:http://supervisord.org/configuration.html#program-x-section-example

Under /etc/supervisor/conf.d/, write a file sample.conf like:

[program:sample]
directory=/path/to/dir/
command=/path/to/file --param
autostart=true
autorestart=true
startretries=5
redirect_stderr=true
stdout_logfile=/path/to/file.log

Commands

$ supervisorctl status
$ supervisorctl reload
$ supervisorctl restart all

$ supervisorctl stop sample
$ supervisorctl start sample
$ supervisorctl restart sample
$ supervisorctl update