CentOS7配置Supervisor开机启动

参考地址: 配置Supervisor开机启动

配置Supervisor开机启动:

新建一个“supervisord.service”文件

  • dservice for systemd (CentOS 7.0+)
  • by ET-CS (https://github.com/ET-CS)

[Unit]
Description=Supervisor daemon

[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
ExecStop=/usr/bin/supervisorctl shutdown
ExecReload=/usr/bin/supervisorctl reload
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

将文件拷贝至:“/usr/lib/systemd/system/supervisord.service”

配置开机自启
systemctl enable supervisord

验证一下是否为开机启动:systemctl is-enabled supervisord

配置变量

使用ENVIRONMENT设置环境变量,如下。
ENVIRONMENT=SITE_ENV=production

重启

supervisorctl reload

使用

举例

[program:saas-message]
command=/usr/bin/php /data/wwwroot/saas-message/bin/swoft http:start
user=nginx
stdout_logfile=/var/log/saas-message.log
autostart=true
autorestart=true
sartsecs=1
startretries=3
redirect_stderr=true

你可能感兴趣的:(CentOS,7,Supervisor,centos,Supervisor)