service_helper.sh 619 B

1234567891011121314151617181920212223242526
  1. #!/bin/sh
  2. set -e -u
  3. case $1 in
  4. start)
  5. nohup /usr/bin/kuiperd >> /var/log/kuiper/nohup.out &
  6. ;;
  7. stop)
  8. pid=$(ps -ef |grep kuiperd |grep -v "grep" | awk '{print $2}')
  9. while $(kill "$pid" 2>/dev/null); do
  10. sleep 1
  11. done
  12. ;;
  13. ping)
  14. if [ "$(curl -sl -w %{http_code} 127.0.0.1:9081 -o /dev/null)" = "200" ]; then
  15. echo pong
  16. else
  17. echo "Ping kuiper failed"
  18. exit 1
  19. fi
  20. ;;
  21. *)
  22. echo "Usage: $SCRIPTNAME {start|stop|ping|restart|force-reload|status}" >&2
  23. exit 3
  24. ;;
  25. esac