安装
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 //启动
当
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来启动