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

你可能感兴趣的:(运维,shell脚本,自动化,休闲,服务器管理)