标签:blog ar sp div art on log amp bs
#! /bin/bash PROGRAM="main" while true; do sleep 1 PRO_NOW=`ps aux | grep $PROGRAM | grep -v grep| wc -l` if [ $PRO_NOW -lt 1 ]; then ./$PROGRAM 2>/dev/null 1>&2 & date >>./tinfo.log echo "test start" >> ./tinfo.log fi PRO_STAT=`ps aux |grep $PROGRAM |grep T|grep -v grep|wc -l` if [ $PRO_STAT -gt 0 ]; then pkill -9 $PROGRAM sleep 1 ./$PROGRAM 2>/dev/null 1>&2 & date >>./tinfo.log echo "test restart" >> ./tinfo.log fi done
标签:blog ar sp div art on log amp bs
原文地址:http://www.cnblogs.com/kangbry/p/4013642.html