summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLV-426 <lv-426@taproot.org.il>2015-01-18 21:43:38 +0200
committerLV-426 <lv-426@taproot.org.il>2015-01-18 21:43:38 +0200
commit39d4ae2b424edf32d457723cba30c65aa55ee4f2 (patch)
tree5a3292a9718860c082c3603472607ed14fbacaf3
parentdd447258465473c4b5bc7525cd24a026d2089928 (diff)
init script: create pidfile under /var/run/$NAME - required to run as USERNAME:GROUPNAME
-rw-r--r--res/debian/rhizi.init8
1 files changed, 7 insertions, 1 deletions
diff --git a/res/debian/rhizi.init b/res/debian/rhizi.init
index c8c6870d..d00d97da 100644
--- a/res/debian/rhizi.init
+++ b/res/debian/rhizi.init
@@ -16,7 +16,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="rhizi-server"
NAME=rhizi
DAEMON=/srv/www/rhizi/rhizi.net/bin/rz_server.py
-PIDFILE=/var/run/$NAME.pid
+PIDFILE=/var/run/$NAME/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
USERNAME=www-data
GROUPNAME=www-data
@@ -38,6 +38,12 @@ ARGS__START_STOP_DAEMON="--make-pidfile --background --chuid ${USERNAME}:${GROUP
# and status_of_proc is working.
. /lib/lsb/init-functions
+# make sure /var/run/$NAME exists with proper +w mode as the uid:gid used to fork the server
+if [ ! -d /var/run/$NAME ]; then
+ mkdir /var/run/$NAME
+ chown ${USERNAME}:${GROUPNAME} /var/run/$NAME
+fi
+
#
# Function that starts the daemon/service
#