1. 生成配置文件
$ echo_supervisord_conf > /etc/supervisord.conf
2.修改配置文件
vi /etc/supervisord.conf
找到
[include]
files = /etc/supervisor/conf.d/*.conf
然后再/etc/supervisor/conf.d/ 目錄里放.conf文件。
比如example.conf
[program:example-8888]
command=/var/www/example/server.py --port=8888
autostart=true ; supervisord守護程序啟動時自動啟動tornado
autorestart=true ; supervisord守護程序重啟時自動重啟tornado
redirect_stderr=true ; 將stderr重定向到stdout
user=www-data
directory=/var/www/example ; cd 到應用目錄
stdout_logfile = /var/www/example/log/server-8888.log