supervisor使用 发表于 2019-05-12 | 分类于 linux linux 进程守护安装12pip install supervisorsupervisord -v 命令12345678910111213141516171819202122232425262728293031323334351.配置路径mkdir -p /etc/supervisor2.完整配置示例echo_supervisord_conf > /etc/supervisor/supervisord.conf3.修改配置vim /etc/supervisor/supervisord.conf添加如下[include]files=/etc/supervisor/conf.d/*.conf4.添加如下配置mkdir -p /etc/supervisor/conf.d/vim /etc/supervisor/conf.d/xmysql.conf[program:myxmysql]command=xmysql -h localhost -u username -p username -d music -r 0.0.0.0 ; 运行程序的命令directory=/home/xiaodong/node-v10.15.3-linux-x64/bin/ ; 执行前要不要先cd到目录去,一般不用autorestart = true ; 程序异常退出后自动重启autostart=true ; 随着supervisord的启动而启动startretries = 10 ; 启动失败自动重试次数,默认是 3numprocs=1 ; 启动几个进程stderr_logfile=/var/log/myxmysql.err.log ; 错误日志文件stdout_logfile=/var/log/myxmysql.out.log ; 输出日志文件environment=A=B ; 进程环境变量user=root ; 进程执行的用户身份stopsignal=KILL ; 用来杀死进程的stopsignal=INT5.启动supervisord -c /etc/supervisor/supervisord.conf或者重新加载配置supervisorctl reload 额外123456把配置文件中 inet_http_server 前面的分号去掉 在Supervisor中 ;是注释的格式 默认是不开启web界面的[inet_http_server] ; inet (TCP) server disabled by defaultport=*:9001 ; (ip_address:port specifier, *:port for all iface)username=user ; (default is no username (open server))password=123