Created
December 28, 2011 18:26
-
-
Save dmitryrck/1529020 to your computer and use it in GitHub Desktop.
/etc/init.d/nginx
This file contains 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/bash | |
### BEGIN INIT INFO | |
# Provides: nginx | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the nginx web server | |
# Description: starts nginx | |
### END INIT INFO | |
DAEMON=/usr/local/nginx/sbin/nginx | |
NAME=nginx | |
DESC=nginx | |
test -x $DAEMON || exit 0 | |
set -e | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
$DAEMON | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
$DAEMON -s stop | |
echo "$NAME." | |
;; | |
restart|force-reload) | |
echo -n "Restarting $DESC: " | |
$DAEMON -s stop | |
sleep 1 | |
$DAEMON | |
echo "$NAME." | |
;; | |
reload) | |
echo -n "Reloading $DESC configuration: " | |
$DAEMON -s reload | |
echo "$NAME." | |
;; | |
*) | |
echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment