From 63126bdbb89f9b69c73abd7b2ba987d80b806daf Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Tue, 21 Jan 2020 22:48:52 +0000 Subject: [PATCH] Make v3 pidfile directory creation dynamic Addition of Zuul v3 initscripts raced the dynamic pidfile directory creation fix Idfd5d19e5171278b9bb7005edb4ae927a01f3615. Port it to them so that if the PIDFILE variable is overridden for a custom path, we create the correct parent directory. Change-Id: I3af4e0eb280eed5dfeab909ad4e3fb24ede75a5a --- files/zuul-launcher.init | 8 ++++++-- files/zuul-mergerv3.init | 8 ++++++-- files/zuul-schedulerv3.init | 8 ++++++-- files/zuul.init | 8 ++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/files/zuul-launcher.init b/files/zuul-launcher.init index 16be1dd..2202ec4 100644 --- a/files/zuul-launcher.init +++ b/files/zuul-launcher.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 diff --git a/files/zuul-mergerv3.init b/files/zuul-mergerv3.init index 9576c42..b78c8a9 100644 --- a/files/zuul-mergerv3.init +++ b/files/zuul-mergerv3.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 diff --git a/files/zuul-schedulerv3.init b/files/zuul-schedulerv3.init index 90e6098..b201ed1 100644 --- a/files/zuul-schedulerv3.init +++ b/files/zuul-schedulerv3.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 diff --git a/files/zuul.init b/files/zuul.init index 18ec85b..d1275a4 100755 --- a/files/zuul.init +++ b/files/zuul.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