帮助中心

这里有最新的使用文档和教程

< 返回

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

2022-11-10 10:38 作者:31IDC 阅读量:832 所属分类:Linux系统

创建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的进程赛程任务了。

31IDC - 12 年深耕海外 IDC 高端资源