关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

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

发布时间:2022-11-17 15:24:02
1491984010112764.jpg

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



/template/Home/8a/PC/Static