매10초마다 프로세서가 죽었는지 살아있는지 체크하는 SHELL
# cat PROCESS_CHECK.sh
while [ true ]
do
NowDate=`date`
NowDateYYYYMMDDHHMMSS=`date '+%Y%m%d%H%M%S'`
PROCESS_NAME="MyProcess 1"
PROCESS_CNT=`ps -ef |grep "$PROCESS_NAME" |grep -v grep | wc -l | awk '{print $1}'`
if [ $PROCESS_CNT -eq 0 ]
then
echo "[$NowDateYYYYMMDDHHMMSS][$PROCESS_NAME][$PROCESS_CNT]...[Dead.....]"
else
echo "[$NowDateYYYYMMDDHHMMSS][$PROCESS_NAME][$PROCESS_CNT]...[Alive....]"
fi
sleep 10
done
# sh PROCESS_CHECK.sh
[20100528102416][MyProcess 1][1]...[Alive....]
[20100528102426][MyProcess 1][1]...[Alive....]
[20100528102436][MyProcess 1][1]...[Alive....]
[20100528102446][MyProcess 1][0]...[Dead.....]
[20100528102456][MyProcess 1][1]...[Alive....]
[20100528102506][MyProcess 1][1]...[Alive....]