123456789101112131415 |
- #!/bin/sh
- cd ../
- PROCESS=`pwd | xargs -i basename {}`
- COUNT=`ps auxf | grep "\./${PROCESS}" | grep -v grep | awk '{printf "%s\n", $0;}' | wc -l`
- if [ $COUNT -lt 1 ]; then
- echo "[`date +'%Y-%m-%d %T'`] process ${PROCESS} number:$COUNT, fork it!"
- cd bin;
- nohup ./$PROCESS &
- else
- echo "[`date +'%Y-%m-%d %T'`] process ${PROCESS} number is normal:$COUNT"
- fi
|