伊索谗言 发表于 2024-9-11 18:08:49

Centos7 apache守护(定时检测apache状态)

创建apache_status.sh文件,并写入以下代码:
vi /root/apache_status.sh

pgrep -x httpd &> /dev/null
if [ $? -ne 0 ];then
      bash /www/server/panel/script/rememory.sh   
      /etc/init.d/httpd start      
fi
:wq   #保存退出
2,crontab -e 进入编辑crond服务,添加如下命令:
*/5 * * * * /root/apache_status.sh

:wq#保存退出

3,重启crond服务
systemctl restart crond

这样就完成了apache的进程赛程任务了。
页: [1]
查看完整版本: Centos7 apache守护(定时检测apache状态)