判斷Apache服務(wù)是否啟動
#!/bin/bash
test=$(ps aux | grep httpd | grep -v grep)
#截取httpd進程,并把結(jié)果賦予變量test
if [ -n "$test" ]
#如果test的值不為空,則執(zhí)行then中命令
then
echo "$(date) httpd is ok!" >> /tmp/autostart-acc.log
else
/etc/rc.d/init.d/httpd start & > /dev/null
echo "$(date) restart httpd !" >> /tmp/autostart-acc.log
fi
問題:我們寫了Apache隨時可以啟動的這個腳本,假如我們Apache服務(wù)卡了,那我們沒有執(zhí)行這個腳本文件,也是沒用?????怎么讓這個腳本隨時再執(zhí)行呢???
2016-09-14
什么意思,卡了又沒掛