summaryrefslogtreecommitdiff
path: root/nginx
diff options
context:
space:
mode:
authorMatt Housh <jaeger@crux.ninja>2016-01-10 09:56:16 -0600
committerMatt Housh <jaeger@crux.ninja>2016-01-10 09:56:16 -0600
commitc66e542fb1f8edfbe2574169f66711890a1679b4 (patch)
treeab0485c5b9e0f3372f637a4b8be3de86c8095692 /nginx
parenta2c18333f7aa5c17bd4bf2301b668d9ec22e27fe (diff)
downloadcontrib-c66e542fb1f8edfbe2574169f66711890a1679b4.tar.gz
contrib-c66e542fb1f8edfbe2574169f66711890a1679b4.tar.xz
nginx: updated rc script to use start-stop-daemon
Diffstat (limited to 'nginx')
-rw-r--r--nginx/.md5sum2
-rw-r--r--nginx/Pkgfile2
-rwxr-xr-x[-rw-r--r--]nginx/nginx.rc54
3 files changed, 34 insertions, 24 deletions
diff --git a/nginx/.md5sum b/nginx/.md5sum
index d3256e690..32768c500 100644
--- a/nginx/.md5sum
+++ b/nginx/.md5sum
@@ -1,3 +1,3 @@
50fdfa08e93ead7a111cba5a5f5735af nginx-1.9.9.tar.gz
93b358681200fe294581cb559d529aee nginx.conf
-d640b1d5d4aad2d24f1e0d85bc5c6798 nginx.rc
+06712aa2b72397850b0725f2e9d20627 nginx.rc
diff --git a/nginx/Pkgfile b/nginx/Pkgfile
index a068ad3c8..ba479e57d 100644
--- a/nginx/Pkgfile
+++ b/nginx/Pkgfile
@@ -5,7 +5,7 @@
name=nginx
version=1.9.9
-release=1
+release=2
source=(http://nginx.org/download/$name-$version.tar.gz \
$name.conf $name.rc)
diff --git a/nginx/nginx.rc b/nginx/nginx.rc
index fbc258959..87aa6be57 100644..100755
--- a/nginx/nginx.rc
+++ b/nginx/nginx.rc
@@ -1,31 +1,41 @@
+#!/bin/sh
#
-# /etc/rc.d/nginx: start, stop or restart nginx server
+# /etc/rc.d/nginx: start/stop the nginx daemon
#
+SSD=/sbin/start-stop-daemon
+PROG=/usr/sbin/nginx
+PID=/var/run/nginx.pid
+
case $1 in
- start)
- PID="`pidof nginx`"
- if [ -s /var/run/nginx.pid -a -n "$PID" ]; then
- echo "nginx is already running"
- exit 1
- fi
- /usr/sbin/nginx
+ "start")
+ $SSD --start --pidfile $PID --exec $PROG
+ ;;
+ "stop")
+ $SSD --stop --retry 10 --pidfile $PID
+ ;;
+ "restart")
+ $0 stop
+ $0 start
;;
- stop)
- /usr/sbin/nginx -s quit
+ "status")
+ $SSD --status --pidfile $PID
+ case $? in
+ 0)
+ echo "$PROG is running with pid $(cat $PID)"
+ ;;
+ 1)
+ echo "$PROG is not running but pid file $PID exists"
+ ;;
+ 3)
+ echo "$PROG is not running"
+ ;;
+ 4)
+ echo "Unable to determine program status"
+ ;;
+ esac
;;
- restart)
- $0 stop; sleep 1; $0 start
- ;;
- status)
- PID="`pidof nginx`"
- if [ -s /var/run/nginx.pid -a -n "$PID" ]; then
- echo "nginx is running. PID(s) = $PID"
- else
- echo "nginx is not running."
- fi
- ;;
*)
- echo "usage: nginx [start|stop|restart]"
+ echo "Usage: $0 [start|stop|restart|status]"
;;
esac

Generated by cgit