1. 程式人生 > >CentOS 7.4 配置 Supervisor 守護程序

CentOS 7.4 配置 Supervisor 守護程序

1、安裝

yum install python-setuptools
easy_install supervisor


2、建立守護程序跟路徑

mkdir -m 700 -p /etc/supervisor


3、在目錄“ /etc/supervisor”下建立配置檔案

echo_supervisord_conf > /etc/supervisor/supervisord.conf


4、修改配置

vim /etc/supervisor/supervisord.conf

在檔案末尾新增
[include]
files=/etc/supervisor/conf.d/*.conf


5、建立配置存放路徑

mkdir -m 700 /etc/supervisor/conf.d


6、建立程序配置檔案,示例:LandingQueueProcess.conf的守護程序,關鍵配置:

touch /etc/supervisor/conf.d/LandingQueueProcess.conf

[program:LandingQueueProcess]
command = /usr/local/php-7.1.13/bin/php artisan queue:work
directory = /usr/local/www/product-chuiyi-site-landing
autorestart = true
autostart = true
startretries = 2
numprocs = 1
stderr_logfile = /tmp/LandingQueueProcess.log
stdout_logfile = /tmp/LandingQueueProcess.log
user = tracker
stopsignal = KILL
stopsignal = INT

7、啟動supervisor

supervisord -c /etc/supervisor/supervisord.conf

ps:如果服務已啟動,修改配置檔案可用“ supervisorctl reload ”命令來使其生效