檢測進程是否存在
#!/bin/sh
while :
do
PID=`cat /home/pid.file`
RUN_FLAG=`ps -p $PID | awk -v var=$PID '$1==var { print "1" }'`
if [ -n "$RUN_FLAG" ] # string is not "null".
then
echo 'running' # running
else
echo 'kao' # restart process
fi
sleep 60 # 1 minute
done
posted on 2007-07-09 21:47 waterye 閱讀(1085) 評論(0) 編輯 收藏 所屬分類: Linux