Hello all,
I already have a solution but wondered if anyone had any slicker methods to do the following.
1. monitor process
2. if process stopped restart
3. if restart fails 3 times, mail admin
My Solution - **Not tested**
#--------
count=0
ps -ef|grep -v grep|grep procname > /tmp/procname
if [ -s /tmp/procname ] ; then
echo "It's running"
else
nohup procname &
fi
while [ $count -le "3" ]
do
rm /tmp/procname
sleep 300
ps -ef|grep -v grep|grep procname > /tmp/procname
if [ -s /tmp/procname ] ; then
echo "It's running"
count=3
else
nohup procname &
count=`expr $count + 1`
fi
done
#-------
Ideas?
--
| Mike Nixon
| Unix Admin
|
----------------------------
I already have a solution but wondered if anyone had any slicker methods to do the following.
1. monitor process
2. if process stopped restart
3. if restart fails 3 times, mail admin
My Solution - **Not tested**
#--------
count=0
ps -ef|grep -v grep|grep procname > /tmp/procname
if [ -s /tmp/procname ] ; then
echo "It's running"
else
nohup procname &
fi
while [ $count -le "3" ]
do
rm /tmp/procname
sleep 300
ps -ef|grep -v grep|grep procname > /tmp/procname
if [ -s /tmp/procname ] ; then
echo "It's running"
count=3
else
nohup procname &
count=`expr $count + 1`
fi
done
#-------
Ideas?
--
| Mike Nixon
| Unix Admin
|
----------------------------