nginx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env bash
  2. #description: Startup and shutdown script for nginx
  3. #define nginx diri
  4. CURRENT_DIR=$(cd "$(dirname "$0")"; pwd)
  5. NGINX_INSTALL="/usr/local/nginx"
  6. NGINX="$NGINX_INSTALL/sbin/nginx"
  7. NGINX_CONFIG="$NGINX_INSTALL/conf/nginx.conf"
  8. NGINX_PID="$NGINX_INSTALL/nginx.pid"
  9. case $1 in
  10. 'start' )
  11. if test -x $NGINX
  12. then
  13. echo "Starting Nginx.. config: $NGINX_CONFIG"
  14. if $NGINX -c $NGINX_CONFIG
  15. then
  16. echo "OK"
  17. else
  18. echo "failed"
  19. fi
  20. else
  21. echo "Couldn't find Nginx($NGINX)"
  22. fi
  23. ;;
  24. 'stop' )
  25. echo "Stopping Nginx..."
  26. if $NGINX -s stop
  27. then
  28. echo "OK"
  29. else
  30. echo "failed"
  31. fi
  32. ;;
  33. 'restart'|'reload' )
  34. if $NGINX -s reload
  35. then
  36. echo "OK"
  37. else
  38. echo "failed"
  39. fi
  40. ;;
  41. 'list' )
  42. ps aux | egrep '(PID|nginx)'
  43. ;;
  44. *)
  45. echo "usage: `basename $0` {start|restart|reload|stop|list}"
  46. esac