Guest User

Untitled

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