Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. BASE_HOME=$(dirname $(readlink -f "$0"))
  4. PID=${BASE_HOME}/.pid
  5.  
  6. status(){
  7. echo "==========status======="
  8. status=`ps -p $$`
  9.  
  10.  
  11. }
  12.  
  13. start() {
  14. echo "==========start==========="
  15. }
  16.  
  17. stop() {
  18. echo "===========stop============"
  19. pid=$$
  20. kill_cmd="pstree -p $pid | awk -F \"[()]\" '{for(i=0;i<=NF;i++)if(\$i~/[0-9]+/)print \$i}' |"'grep -v -E "\[|\(|\)|\]"|xargs kill -9'
  21. eval ${kill_cmd}
  22. }
  23.  
  24. restart() {
  25. stop;
  26. echo "sleeping.........";
  27. sleep 3;
  28. start;
  29.  
  30. }
  31. case "$1" in
  32. 'start')
  33. start
  34. ;;
  35. 'stop')
  36. stop
  37. ;;
  38. 'status')
  39. status
  40. ;;
  41. 'restart')
  42. restart
  43. ;;
  44. *)
  45. echo "usage: $0 {start|stop|restart|status}"
  46. exit 1
  47. ;;
  48. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement