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
5.查看進程