1. yum install epel-release 2. yum install -y supervisor 3. systemctl enable supervisord # 开机自启动 4. systemctl start supervisord # 启动supervisord服务 (supervisord -c /etc/supervisord.conf ) 5. systemctl status supervisord # 查看supervisord服务状态 6. ps -ef|grep supervisord # 查看是否存在supervisord进程 7. supervisorctl -c /etc/supervisord.conf #查看进程中的任务 启动时如果出现这种错误: Starting supervisor: Error: Another program is already listening on a port that one of our HTTP servers is configured to use. Shut this program down first before starting supervisord. 执行 unlink /配置文件里的路径/supervisor.sock 配置文件 /etc/supervisord.conf 末尾添加以下代码: [program: notify] command=/usr/local/php/bin/php think queue:work --daemon --queue notice ; 运行程序的命令 directory=/data/wwwroot/www ; 命令执行的目录 ;process_name=%(process_num)02d ;numprocs=5#启动几个进程 autorestart=true; 程序意外退出是否自动重启 autostart=true; 是否自动启动 startsecs=1 ; 自动重启间隔 程序重启时候停留在 runing状态的秒数 startretries=10 ;启动失败时的最多重试次数 stderr_logfile=/data/wwwlogs/log/notice.err.log ; 错误日志文件 stdout_logfile=/data/wwwlogs/log/notice.out.log ; 输出日志文件 environment=ASPNETCORE_ENVIRONMENT=Production ; 进程环境变量 user=root ; 进程执行的用户身份 stopsignal=INT
更新新的配置到supervisord #supervisorctl update 重新启动配置中的所有程序 #supervisorctl reload 启动某个进程(program_name=你配置中写的程序名称) #supervisorctl start program_name 重启某一进程 (program_name=你配置中写的程序名称) #supervisorctl restart program_name 停止全部进程 # supervisorctl stop all
原文链接:https://www.jianshu.com/p/8605fcdb1138
原文:https://www.cnblogs.com/wangcongxing/p/12520240.html