start.sh 375 B

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