Guest User

Untitled

a guest
Jul 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 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:/sbin:/bin:/usr/sbin:/usr/bin:/opt/nginx/sbin
  14. DAEMON=/opt/nginx/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. . /lib/lsb/init-functions
  28.  
  29. case "$1" in
  30. start)
  31. echo -n "Starting $DESC: "
  32. start-stop-daemon --start --quiet --pidfile /opt/nginx/logs/$NAME.pid \
  33. --exec $DAEMON -- $DAEMON_OPTS || true
  34. echo "$NAME."
  35. ;;
  36. stop)
  37. echo -n "Stopping $DESC: "
  38. start-stop-daemon --stop --quiet --pidfile /opt/nginx/logs/$NAME.pid \
  39. --exec $DAEMON || true
  40. echo "$NAME."
  41. ;;
  42. restart|force-reload)
  43. echo -n "Restarting $DESC: "
  44. start-stop-daemon --stop --quiet --pidfile \
  45. /opt/nginx/logs/$NAME.pid --exec $DAEMON || true
  46. sleep 1
  47. start-stop-daemon --start --quiet --pidfile \
  48. /opt/nginx/logs/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
  49. echo "$NAME."
  50. ;;
  51. reload)
  52. echo -n "Reloading $DESC configuration: "
  53. start-stop-daemon --stop --signal HUP --quiet --pidfile /opt/nginx/logs/$NAME.pid \
  54. --exec $DAEMON || true
  55. echo "$NAME."
  56. ;;
  57. status)
  58. status_of_proc -p /opt/nginx/logs/$NAME.pid "$DAEMON" nginx && exit 0 || exit $?
  59. ;;
  60. *)
  61. N=/etc/init.d/$NAME
  62. echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
  63. exit 1
  64. ;;
  65. esac
  66.  
  67. exit 0
Add Comment
Please, Sign In to add comment