一、判断进程是否挂掉
#!/bin/sh
ps -ef | grep httpd | grep -v grep
if [ $? -ne 0 ]
then
echo "start process......"
else
echo "runing......"
fi
二、判断进程是否挂掉,如果挂掉需重启
#!/bin/sh
while true;do
ps -ef | grep httpd | grep -v grep
if [ $? -ne 0 ]
then
echo "start process......"
service httpd start
else
echo "runing......"
fi
sleep 20
done