shell管理lighttpd進程的腳本

最近自己管理的服務器的一些進程老實僵死或者掛掉

所以寫了個腳本來自動啓動僵死或者掛了的服務

#!/bin/sh
if [ "`pidof lighttpd`" ]
then
{
a=`nmap  127.0.0.1  | grep 80  | awk '{print $2}'`
if [ $a!=open ]
then
killall -9 lighttpd
sleep 1
/usr/local/lighttpd.1.3.9.3/sbin/lighttpd -f /usr/local/lighttpd.1.3.9.3/lighttpd.conf
else
exit 0
fi
}
else
while [ ! "`pidof lighttpd`" ]
do
/usr/local/lighttpd.1.3.9.3/sbin/lighttpd -f /usr/local/lighttpd.1.3.9.3/lighttpd.conf
sleep 1
done
fi

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章