Advertisement
ibanezzaro

Untitled

Oct 28th, 2016
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 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. PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  14. DAEMON=/usr/sbin/nginx
  15. NAME=nginx
  16. DESC=nginx
  17.  
  18. test -x $DAEMON || exit 0
  19.  
  20. # Include nginx defaults if available
  21. if [ -f /etc/default/nginx ] ; then
  22. . /etc/default/nginx
  23. fi
  24.  
  25. set -e
  26.  
  27. case "$1" in
  28. start)
  29. echo -n "Starting $DESC: "
  30. start-stop-daemon --start --quiet --pidfile /var/run/nginx.pid \
  31. --exec $DAEMON -- $DAEMON_OPTS
  32. echo "$NAME."
  33. ;;
  34. stop)
  35. echo -n "Stopping $DESC: "
  36. start-stop-daemon --stop --quiet --pidfile /var/run/nginx.pid \
  37. --exec $DAEMON
  38. echo "$NAME."
  39. ;;
  40. restart|force-reload)
  41. echo -n "Restarting $DESC: "
  42. start-stop-daemon --stop --quiet --pidfile \
  43. /var/run/nginx.pid --exec $DAEMON
  44. sleep 1
  45. start-stop-daemon --start --quiet --pidfile \
  46. /var/run/nginx.pid --exec $DAEMON -- $DAEMON_OPTS
  47. echo "$NAME."
  48. ;;
  49. reload)
  50. echo -n "Reloading $DESC configuration: "
  51. start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/nginx.pid \
  52. --exec $DAEMON
  53. echo "$NAME."
  54. ;;
  55. *)
  56. N=/etc/init.d/$NAME
  57. echo "Usage: $N {start|stop|restart|force-reload}" >&2
  58. exit 1
  59. ;;
  60. esac
  61.  
  62. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement