diff --git a/files/zuul-executor.init b/files/zuul-executor.init index 06bfdb9..b9e8f1a 100644 --- a/files/zuul-executor.init +++ b/files/zuul-executor.init @@ -33,6 +33,8 @@ USER=root # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions +PIDFILE_DIR=$(dirname $PIDFILE) + # # Function that starts the daemon/service # @@ -44,8 +46,10 @@ do_start() # 2 if daemon could not be started # 3 if pid file already exist - mkdir -p /var/run/$NAME - chown $USER /var/run/$NAME + if [ ! -d "$PIDFILE_DIR" ] ; then + mkdir -p $PIDFILE_DIR + chown $USER $PIDFILE_DIR + fi ulimit -n 8192 ulimit -c unlimited if [ -f $PIDFILE ]; then @@ -68,7 +72,9 @@ do_start() do_stop() { $DAEMON stop - rm -f /var/run/$NAME/* + if [ -f "$PIDFILE" ] ; then + rm -f $PIDFILE + fi return 0 } diff --git a/files/zuul-fingergw.init b/files/zuul-fingergw.init index 080cae2..c5019ff 100644 --- a/files/zuul-fingergw.init +++ b/files/zuul-fingergw.init @@ -33,6 +33,8 @@ USER=root # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions +PIDFILE_DIR=$(dirname $PIDFILE) + # # Function that starts the daemon/service # @@ -44,8 +46,10 @@ do_start() # 2 if daemon could not be started # 3 if pid file already exist - mkdir -p /var/run/$NAME - chown $USER /var/run/$NAME + if [ ! -d "$PIDFILE_DIR" ] ; then + mkdir -p $PIDFILE_DIR + chown $USER $PIDFILE_DIR + fi ulimit -n 8192 if [ -f $PIDFILE ]; then return 3 @@ -74,7 +78,9 @@ do_stop() start-stop-daemon --stop --signal 9 --pidfile $PIDFILE RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 - rm -f /var/run/$NAME/* + if [ -f "$PIDFILE" ] ; then + rm -f $PIDFILE + fi return "$RETVAL" } diff --git a/files/zuul-merger.init b/files/zuul-merger.init index be6740e..13170b6 100644 --- a/files/zuul-merger.init +++ b/files/zuul-merger.init @@ -33,6 +33,8 @@ USER=zuul # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions +PIDFILE_DIR=$(dirname $PIDFILE) + # # Function that starts the daemon/service # @@ -44,8 +46,10 @@ do_start() # 2 if daemon could not be started # 3 if pid file already exist - mkdir -p /var/run/$NAME - chown $USER /var/run/$NAME + if [ ! -d "$PIDFILE_DIR" ] ; then + mkdir -p $PIDFILE_DIR + chown $USER $PIDFILE_DIR + fi ulimit -n 8192 if [ -f $PIDFILE ]; then return 3 @@ -74,7 +78,9 @@ do_stop() start-stop-daemon --stop --signal 9 --pidfile $PIDFILE RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 - rm -f /var/run/$NAME/* + if [ -f "$PIDFILE" ] ; then + rm -f $PIDFILE + fi return "$RETVAL" } diff --git a/files/zuul-scheduler.init b/files/zuul-scheduler.init index 458c355..b8f18ce 100644 --- a/files/zuul-scheduler.init +++ b/files/zuul-scheduler.init @@ -33,6 +33,8 @@ USER=zuul # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions +PIDFILE_DIR=$(dirname $PIDFILE) + # # Function that starts the daemon/service # @@ -44,8 +46,10 @@ do_start() # 2 if daemon could not be started # 3 if pid file exits already - mkdir -p /var/run/$NAME - chown $USER /var/run/$NAME + if [ ! -d "$PIDFILE_DIR" ] ; then + mkdir -p $PIDFILE_DIR + chown $USER $PIDFILE_DIR + fi ulimit -n 8192 if [ -f $PIDFILE ]; then return 3 @@ -74,7 +78,9 @@ do_stop() start-stop-daemon --stop --signal 9 --pidfile $PIDFILE RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 - rm -f /var/run/$NAME/* + if [ -f "$PIDFILE" ] ; then + rm -f $PIDFILE + fi return "$RETVAL" } diff --git a/files/zuul-web.init b/files/zuul-web.init index f0fd3fa..3dbcfca 100644 --- a/files/zuul-web.init +++ b/files/zuul-web.init @@ -33,6 +33,8 @@ USER=zuul # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions +PIDFILE_DIR=$(dirname $PIDFILE) + # # Function that starts the daemon/service # @@ -44,8 +46,10 @@ do_start() # 2 if daemon could not be started # 3 if pid file already exist - mkdir -p /var/run/$NAME - chown $USER /var/run/$NAME + if [ ! -d "$PIDFILE_DIR" ] ; then + mkdir -p $PIDFILE_DIR + chown $USER $PIDFILE_DIR + fi ulimit -n 8192 if [ -f $PIDFILE ]; then return 3 @@ -74,7 +78,9 @@ do_stop() start-stop-daemon --stop --signal 9 --pidfile $PIDFILE RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 - rm -f /var/run/$NAME/* + if [ -f "$PIDFILE" ] ; then + rm -f $PIDFILE + fi return "$RETVAL" }