Background: The public test server environment, service is always inexplicable process is stopped
Workaround: Use the supervisor conduct process management, the process is aborted when the service can automatically restart
Installation command:
sudo apt-get install supervisor
Process configuration, xxx.conf, examples of new content in /etc/supervisor/cond.d in:
[program:abc]
directory=/data/deploy/master/system/test_env/abc
command=/usr/bin/nohup bin/abc &
stdout_logfile=/etc/supervisor/conf.d/log.out
autostart=true
autorestart=true
startsecs=60
priority=1
stopasgroup=true
killasgroup=true
Process group configuration, modify /etc/supervisor/supervisord.conf, add the following configuration:
[group:XXXX]
programs = abc,bcd
priority = 999
To increase http_server (see the operation process in a browser), modify /etc/supervisor/supervisord.conf, add the following configuration:
[inet_http_server] ; inet (TCP) server disabled by default
port=*:9001 ; (ip_address:port specifier, *:port for all iface)
username=**** ; (default is no username (open server))
password=****
Start command:
supervisord -c /etc/supervisor/supervisord.conf
common problem:
Run by non-root privileges supervisord error:
error: <class 'socket.error'>, [Errno 13] Permission denied: file: /usr/lib/python2.7/socket.py line: 224
Solution, modified as follows:
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
chmod=0766 ; socket file mode (default 0700)