Created
December 6, 2012 07:43
-
-
Save geta6/4222593 to your computer and use it in GitHub Desktop.
/etc/init.d/nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh -e | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $local_fs $remote_fs $network | |
# Required-Stop: $local_fs $remote_fs $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
### END INIT INFO | |
NAME=nginx | |
DAEMON=/usr/local/sbin/$NAME | |
PID=/usr/local/var/run/$NAME.pid | |
export PATH="${PATH:+$PATH:}/sbin" | |
[ -x $DAEMON ] || exit 0 | |
[ -e /etc/default/$NAME ] && . /etc/default/$NAME | |
. /lib/lsb/init-functions | |
case "$1" in | |
start) | |
log_daemon_msg "Starting web server" "$NAME" | |
start-stop-daemon --start --quiet --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS | |
log_end_msg 0 | |
;; | |
stop) | |
log_daemon_msg "Starting web server" "$NAME" | |
start-stop-daemon --stop --quiet --pidfile $PID --exec $DAEMON | |
log_end_msg 0 | |
;; | |
reload) | |
log_daemon_msg "Reloading web server" "$NAME" | |
start-stop-daemon --stop --oknodo --signal HUP --quiet --pidfile $PID --exec $DAEMON | |
log_end_msg 0 | |
;; | |
restart|force-reload) | |
log_daemon_msg "Restarting web server" "$NAME" | |
start-stop-daemon --stop --quiet --pidfile $PID --exec $DAEMON | |
sleep 1 | |
start-stop-daemon --start --quiet --pidfile $PID --exec $DAEMON -- $DAEMON_OPTS | |
log_end_msg 0 | |
;; | |
status) | |
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? | |
;; | |
*) | |
N=/etc/init.d/$NAME | |
echo "Usage: $N {start|stop|reload|restart|force-reload|status}" | |
exit 2 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment