进程管理工具 Supervisor 安装配置

  • 安装
# centos 安装: 
yum install -y supervisor
# ubuntu 安装: 
sudo apt-get install supervisor
  • 配置
# 配置文件路径: /etc/supervisor/supervisord.conf

# 进程管理配置文件:
vim /etc/supervisor/conf.d/test.conf
# 写入如下内容
[program:test]
command=/data/php/test/yii2/index_cli.php test index
directory=.
stderr_logfile=/var/log/supervisor/test.log      	# 错误日志输出路径
stdout_logfile=/var/log/supervisor/test.log				# 志输出路径 
startsecs=0
stopwaitsecs=0
autostart=true											# 自动启动
user=root                          	# 指定用户
autorestart=true										# 自动重启
# 保存退出

# 启动
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
ps -ef | grep test

# 加载新的配置文件
supervisorctl update

# 载入最新的配置文件,停止原有进程并按新的配置启动、管理所有进程
supervisorctl reload

# 开机启动
# CentOS
chkconfig supervisord on
# Ubuntu
systemctl enable supervisord
发布了119 篇原创文章 · 获赞 12 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/hualaoshuan/article/details/103591732