$ sudo apt-get install supervisor
$ echo_supervisord_conf > /etc/supervisor/supervisord.conf
$ vim /etc/supervisor/supervisord.conf
;[include]
;files = relative/directory/*.ini
修改为:
[include]
files=/etc/supervisor/conf.d/*.conf
$ cd /etc/supervisor/conf.d/
$ touch monibuca.conf
root@htgl:/etc/supervisor/conf.d# cat monibuca.conf
[program:monibuca]
directory=/opt/monibuca
command=nohup ./m7s &
environment=ASPNETCORE__ENVIRONMENT=Production
user=root
startretries = 3
stopsignal=INT
autostart=true
autorestart=true
startsecs=1
stderr_logfile=/var/log/monibuca.err.log
stdout_logfile=/var/log/monibuca.out.log
$ sudo chmod 777 /var/run
$ sudo chmod 777 /etc/supervisor
$ sudo touch /var/run/supervisor.sock
$ sudo chmod 777 /var/run/supervisor.sock
$ sudo service supervisor restart
$ supervisord
supervisorctl stop program_name 停止某个进程
supervisorctl start program_name 启动某个进程
supervisorctl restart program_name 重启某个进程
supervisorctl stop all 停止全部进程
supervisorctl reload 载入最新的配置文件,停止原有进程并按新的配置启动、管理所有进程
supervisorctl update 根据最新的配置文件,启动新配置或有改动的进程,配置没有改动的进程不会受影响而重启
supervisorctl status
supervisorctl restart monibuca
$ ps -ef | grep supervisord
$ sudo kill -9 5622
$ supervisord -c /etc/supervisor/supervisord.conf
supervisorctl restart
$ supervisord -v
如果配置正确,切提示ERROR(no such process),检查 /etc/supervisor/supervisord.conf
原创文章,作者:1402239773,如若转载,请注明出处:https://blog.ytso.com/267096.html