安裝
sudo apt–get install supervisor
在 /etc/supervisord.conf
中查看
[include]
files=/etc/supervisor/*.conf
然后寫 *.conf文件
[program:xxx-worker]
process_name=%(program_name)s
directory=/path/to/project
command=/path/to/project/main arg1 arg2
autostart=true
autorestart=true
user=gamedev
numprocs=1
redirect_stderr=true
stdout_logfile=/var/log/xxx-worker.log
然后
sudo supervisorctl reread //檢查配置語法
sudo supervisorctl update //更新配置語法
sudo supervisorctl start xxx-worker //啟動
當(dāng)
supervisorctl reread但是在centos上使用這個命令會報錯error: <class 'socket.error'>, [Errno 2] No such file or directory: file: /usr/lib64/python2.7/socket.py line: 224
解決辦法:supervisord -c /etc/supervisor/supervisord.conf來啟動