aboutsummaryrefslogtreecommitdiff
path: root/network/nginx/rc.nginx
diff options
context:
space:
mode:
Diffstat (limited to 'network/nginx/rc.nginx')
-rw-r--r--network/nginx/rc.nginx62
1 files changed, 32 insertions, 30 deletions
diff --git a/network/nginx/rc.nginx b/network/nginx/rc.nginx
index 548345842540..88b917d36052 100644
--- a/network/nginx/rc.nginx
+++ b/network/nginx/rc.nginx
@@ -6,7 +6,6 @@
# To use nginx, you must first set up the config file(s).
#
# Written for Slackware Linux by Cherife Li <cherife@dotimes.com>.
-#
DAEMON=/usr/sbin/nginx
CONF=/etc/nginx/nginx.conf
@@ -15,12 +14,12 @@ PID=/var/run/nginx.pid
nginx_start() {
# Sanity checks.
if [ ! -r $CONF ]; then # no config file, exit:
- echo "Please check the nginx config file, exiting..."
+ echo "$CONF does not appear to exist; exiting..."
exit 1
fi
- if [ -f $PID ]; then
- echo "Nging is already running?"
+ if [ -s $PID ]; then
+ echo "Nginx appears to already be running..."
exit 1
fi
@@ -31,7 +30,8 @@ nginx_start() {
}
nginx_test_conf() {
- echo -e "Checking configuration for correct syntax and\nthen trying to open files referenced in configuration..."
+ echo "Checking configuration for correct syntax and"
+ echo "then trying to open files referenced in configuration..."
$DAEMON -t -c $CONF
}
@@ -40,7 +40,7 @@ nginx_term() {
kill -TERM $(cat $PID)
}
-nginx_quit() {
+nginx_stop() {
echo "Shutdown Nginx gracefully..."
kill -QUIT $(cat $PID)
}
@@ -51,7 +51,9 @@ nginx_reload() {
}
nginx_upgrade() {
- echo -e "Upgrading to the new Nginx binary.\nMake sure the Nginx binary has been replaced with new one\nor Nginx server modules were added/removed."
+ echo "Upgrading to the new Nginx binary."
+ echo "Make sure the Nginx binary has been replaced with new one"
+ echo "or Nginx server modules were added/removed."
kill -USR2 $(cat $PID)
sleep 3
kill -QUIT $(cat $PID.oldbin)
@@ -64,27 +66,27 @@ nginx_restart() {
}
case "$1" in
-'start')
- nginx_start
- ;;
-'term')
- nginx_term
- ;;
-'quit')
- nginx_quit
- ;;
-'stop')
- nginx_quit
- ;;
-'reload')
- nginx_reload
- ;;
-'restart')
- nginx_restart
- ;;
-'upgrade')
- nginx_upgrade
- ;;
-*)
- echo "usage $0 start|term|quit(stop)|reload|restart|upgrade"
+ check)
+ nginx_test_conf
+ ;;
+ start)
+ nginx_start
+ ;;
+ term)
+ nginx_term
+ ;;
+ stop)
+ nginx_stop
+ ;;
+ reload)
+ nginx_reload
+ ;;
+ restart)
+ nginx_restart
+ ;;
+ upgrade)
+ nginx_upgrade
+ ;;
+ *)
+ echo "usage: $0 {check|start|term|stop|reload|restart|upgrade}"
esac