技術(shù)文檔
幫助中心 > 技術(shù)文檔 >
Centos7 apache守護(hù)(定時(shí)檢測(cè)apache狀態(tài))
2023-12-13 作者:簡(jiǎn)米科技 閱讀量:0 所屬分類(lèi):技術(shù)文檔創(chuàng)建apache_status.sh文件,并寫(xiě)入以下代碼:
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 進(jìn)入編輯crond服務(wù),添加如下命令:
*/5 * * * * /root/apache_status.sh
:wq #保存退出
3,重啟crond服務(wù)
systemctl restart crond
這樣就完成了apache的進(jìn)程賽程任務(wù)了。
標(biāo)簽: