我们正在使用Supervisord来监视apache服务器进程。
因此,我希望在以下两种情况下始终保持主管过程正常:
我们还安装了ansible。
如果有人能分享他们的想法,那就太好了。
发布于 2017-02-16 07:44:30
我将从ansible开始--您可以使用它安装监控器(例如,使用apt模块,必要时使用yum模块 ):
- name: Install Supervisord
apt: name=supervisor state=present update_cache=yes
become: yes并部署必要的监督配置文件(使用复制模块)。
- name: Deploy config file
copy: src=yourconfigfile.conf dest=/etc/supervisor/conf.d/apache.conf mode=644
become: yes要自动启动监控器本身,只需启用它(您可以使用启用服务模块的:是的)。若要使监控程序自动启动和自动重新启动,请在程序配置文件中设置正确的指令。示例:
[program:apache]
command=apache2ctl -c "ErrorLog /dev/stdout" -DFOREGROUND
# this would autostart apache
autostart=true
# this would autorestart it if it crashes
autorestart=true
startretries=1
startsecs=1
redirect_stderr=true
stderr_logfile=/var/log/myapache.err.log
stdout_logfile=/var/log/myapache.out.log
user=root
killasgroup=true
stopasgroup=truehttps://stackoverflow.com/questions/42267624
复制相似问题