5.守护进程
5.守护进程
一、supervisor
# epel源
yum install epel-release
# 安装supervisor
yum install -y supervisor
# 开机自启动
systemctl enable supervisord
# 启动supervisord服务
systemctl start supervisord
在程序配置文件夹/etc/supervisord.d中添加test.ini:
[program:test]
directory=/home/wwwroot/test.cc
command=php test.php
autostart=true
autorestart=true
stderr_logfile=/home/wwwroot/test.cc/log/error.log
stdout_logfile=/home/wwwroot/test.cc/log/out.log
日志目录必须存在
运行重启或者重载配置命令加载新配置:
systemctl restart supervisord
systemctl reload supervisord
查看进程:
ps -aux | grep test.php(替换)
supervisorctl管理命令
supervisorctl start projectname #启动进程 supervisorctl stop projectname #结束进程 supervisorctl restart projectname #重启进程 supervisorctl stop all #停止所有进程 supervisorctl update #更新变动的进程配置 supervisorctl reload #重启所有进程 supervisorctl status #查看进程状态

浙公网安备 33010602011771号