check_all.sh 629 B

12345678910111213141516171819202122
  1. #! /bin/sh
  2. PATH=/sbin:/usr/sbin:/usr/local/sbin:/opt/gnome/sbin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/root/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/lib/mit/bin:/usr/lib/mit/sbin
  3. APP=miads
  4. cd /data2/app/$APP
  5. PROCESS=`pwd | xargs -i basename {}`
  6. #for process number check and alert send
  7. processnum=`/bin/ps -ef | grep "\./${PROCESS}" | grep -v grep |/usr/bin/wc -l`
  8. if [ $processnum -lt 1 ]
  9. then
  10. echo "${PROCESS} processnum is $processnum less than 1, please check"
  11. cd /data2/app/${PROCESS}/tools/
  12. ./start.sh
  13. else
  14. echo $processnum
  15. fi
  16. echo "Done."