stopLookupD.sh 413 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. appname=smqlookupd
  3. is_exist(){
  4. pid=`ps -ef|grep $appname|grep -v grep|awk '{print $2}' `
  5. #如果不存在返回1,存在返回0
  6. if [ -z "${pid}" ]; then
  7. return 1
  8. else
  9. return 0
  10. fi
  11. }
  12. is_exist
  13. if [ $? -eq "0" ]; then
  14. echo ">>> PID = $pid begin kill -9 $pid <<<"
  15. kill -9 $pid
  16. sleep 2
  17. echo ">>> $appname process stopped <<<"
  18. else
  19. echo ">>> $appname is not running <<<"
  20. fi