1.supervisor安装
apt-get install supervisor
2.编写php配置文件,文件名为.conf
[program:pmapp]
command=/usr/bin/php -f /var/www/MosquittoPhpApp/Mqtt_test.php
;process_name=%(process_num)02d
;numprocs=5 #启动几个进程
autostart=true #随着supervisord的启动而启动
autorestart=true #自动启动
startsecs=1 #程序重启时候停留在runing状态的秒数
startretries=10 #启动失败时的最多重试次数
redirect_stderr=true #重定向stderr到stdout
stdout_logfile=/var/www/MosquittoPhpApp/pmapp.log #stdout文件
user=daemon
[supervisord]
[supervisorctl]
3.将文件放入/etc/supervisor/conf.d/下面
4.重启服务 update 有问题,以后有时间再重点解决
root@iZ252f8y3biZ:/# service supervisor start
Starting supervisor: Error: .ini file does not include supervisord section
For help, use /usr/bin/supervisord -h
service supervisor restart