S50nginx 676 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. #
  3. # Start/stop nginx
  4. #
  5. NGINX=/usr/sbin/nginx
  6. PIDFILE=/var/run/nginx.pid
  7. case "$1" in
  8. start)
  9. echo "Starting nginx..."
  10. mkdir -p /var/log/nginx /var/tmp/nginx
  11. start-stop-daemon -S -x "$NGINX" -p "$PIDFILE"
  12. ;;
  13. stop)
  14. echo "Stopping nginx..."
  15. # Use -R 1 to wait for nginx to actually stop. Useful so
  16. # restart has no race condition. Note that BusyBox knows
  17. # about -R but ignores it silently.
  18. start-stop-daemon -K -x "$NGINX" -p "$PIDFILE" -R 1 -o
  19. ;;
  20. reload|force-reload)
  21. echo "Reloading nginx configuration..."
  22. "$NGINX" -s reload
  23. ;;
  24. restart)
  25. "$0" stop
  26. "$0" start
  27. ;;
  28. *)
  29. echo "Usage: $0 {start|stop|restart|reload|force-reload}"
  30. exit 1
  31. esac