最近自己管理的服務器的一些進程老實僵死或者掛掉
所以寫了個腳本來自動啓動僵死或者掛了的服務
#!/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