aboutsummaryrefslogtreecommitdiffstats
path: root/main/nginx/nginx.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-03-24 07:58:07 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-03-24 07:58:45 +0000
commit968b8aa5e3dcade268c50c9c1299693d4e2255a1 (patch)
treec6814f7a73a0cd391bde30fb1d070e227a06a5f2 /main/nginx/nginx.initd
parent86a8e29be8a181997c0d95f6b15550cff478a30c (diff)
downloadaports-968b8aa5e3dcade268c50c9c1299693d4e2255a1.tar.bz2
aports-968b8aa5e3dcade268c50c9c1299693d4e2255a1.tar.xz
main/nginx: fix path locations
Diffstat (limited to 'main/nginx/nginx.initd')
-rw-r--r--main/nginx/nginx.initd40
1 files changed, 18 insertions, 22 deletions
diff --git a/main/nginx/nginx.initd b/main/nginx/nginx.initd
index 6c47db1d1c..f3fd6b65f1 100644
--- a/main/nginx/nginx.initd
+++ b/main/nginx/nginx.initd
@@ -6,31 +6,26 @@
extra_started_commands="upgrade reload"
extra_commands="configtest"
+conffile=/etc/nginx/nginx.conf
+
+pidfile=/var/run/nginx/nginx.pid
+command=/usr/sbin/nginx
+command_args="-c $conffile"
+
+
depend() {
need net
use dns logger netmount
}
-start() {
+start_pre() {
configtest || return 1
- ebegin "Starting nginx"
- start-stop-daemon --start --pidfile /var/run/nginx.pid \
- --exec /usr/sbin/nginx -- -c /etc/nginx/nginx.conf
- eend $? "Failed to start nginx"
-}
-
-stop() {
- configtest || return 1
- ebegin "Stopping nginx"
- start-stop-daemon --stop --pidfile /var/run/nginx.pid
- eend $? "Failed to stop nginx"
- rm -f /var/run/nginx.pid
}
reload() {
configtest || return 1
ebegin "Refreshing nginx' configuration"
- kill -HUP `cat /var/run/nginx.pid` &>/dev/null
+ kill -HUP `cat $pidfile` &>/dev/null
eend $? "Failed to reload nginx"
}
@@ -39,26 +34,26 @@ upgrade() {
ebegin "Upgrading nginx"
einfo "Sending USR2 to old binary"
- kill -USR2 `cat /var/run/nginx.pid` &>/dev/null
+ kill -USR2 `cat $pidfile` &>/dev/null
einfo "Sleeping 3 seconds before pid-files checking"
sleep 3
- if [ ! -f /var/run/nginx.pid.oldbin ]; then
- eerror "File with old pid not found"
+ if [ ! -f $pidfile.oldbin ]; then
+ eerror "File with old pid ($pidfile.oldbin) not found"
return 1
fi
- if [ ! -f /var/run/nginx.pid ]; then
+ if [ ! -f $pidfile ]; then
eerror "New binary failed to start"
return 1
fi
einfo "Sleeping 3 seconds before WINCH"
- sleep 3 ; kill -WINCH `cat /var/run/nginx.pid.oldbin`
+ sleep 3 ; kill -WINCH `cat $pidfile.oldbin`
einfo "Sending QUIT to old binary"
- kill -QUIT `cat /var/run/nginx.pid.oldbin`
+ kill -QUIT `cat $pidfile.oldbin`
einfo "Upgrade completed"
@@ -67,7 +62,8 @@ upgrade() {
configtest() {
ebegin "Checking nginx' configuration"
- mkdir -p /tmp/nginx
- /usr/sbin/nginx -c /etc/nginx/nginx.conf -tq
+ checkpath --directory --owner nginx:nginx ${pidfile%/*}
+ $command -c $conffile -tq
eend $? "failed, please correct errors above"
}
+