Shell script to monitor the process

Shell script to monitor the process
P=`ps -ef|grep -w "P_NAME"|grep -v grep`
if [ "$P" != "" ]; then
echo "P_NAME OK!"
else
#do some shit
echo "P_NAME started"
fi

Guess you like

Origin blog.csdn.net/hardyer/article/details/109096521