Guest User

Untitled

a guest
Dec 15th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. #! /bin/sh
  2.  
  3. ### BEGIN INIT INFO
  4. # Provides: nginx
  5. # Required-Start: $all
  6. # Required-Stop: $all
  7. # Default-Start: 2 3 4 5
  8. # Default-Stop: 0 1 6
  9. # Short-Description: starts the nginx web server
  10. # Description: starts nginx using start-stop-daemon
  11. ### END INIT INFO
  12. #
  13. # /etc/init.d/nginx
  14.  
  15.  
  16. PATH=/opt/nginx/sbin:/sbin:/bin:/usr/sbin:/usr/bin
  17. DAEMON=/opt/nginx/sbin/nginx
  18. NAME=nginx
  19. DESC=nginx
  20.  
  21. test -x $DAEMON || exit 0
  22.  
  23. # Include nginx defaults if available
  24. if [ -f /etc/default/nginx ] ; then
  25. . /etc/default/nginx
  26. fi
  27.  
  28. set -e
  29.  
  30. case "$1" in
  31. start)
  32. echo -n "Starting $DESC: "
  33. start-stop-daemon --start --quiet --pidfile /opt/nginx/logs/$NAME.pid \
  34. --exec $DAEMON -- $DAEMON_OPTS
  35. echo "$NAME."
  36. ;;
  37. stop)
  38. echo -n "Stopping $DESC: "
  39. start-stop-daemon --stop --quiet --pidfile /opt/nginx/logs/$NAME.pid \
  40. --exec $DAEMON
  41. echo "$NAME."
  42. ;;
  43. restart|force-reload)
  44. echo -n "Restarting $DESC: "
  45. start-stop-daemon --stop --quiet --pidfile \
  46. /opt/nginx/logs/$NAME.pid --exec $DAEMON
  47. sleep 1
  48. start-stop-daemon --start --quiet --pidfile \
  49. /opt/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
  50. echo "$NAME."
  51. ;;
  52. reload)
  53. echo -n "Reloading $DESC configuration: "
  54. start-stop-daemon --stop --signal HUP --quiet --pidfile /opt/nginx/logs/$NAME.pid \
  55. --exec $DAEMON
  56. echo "$NAME."
  57. ;;
  58. *)
  59. N=/etc/init.d/$NAME
  60. echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
  61. exit 1
  62. ;;
  63. esac
  64.  
  65. exit 0
Add Comment
Please, Sign In to add comment