Don't assume pidfile location
When configuring the dir for the pidfiles in our init scripts don't assume the path is /var/run/$NAME. The defaults are now /var/run/zuul now and could be set to other values as well. Instead of assuming /var/run/$NAME we instead take the dirname of $PIDFILE and configure whatever that dir is instead. Change-Id: Idfd5d19e5171278b9bb7005edb4ae927a01f3615
This commit is contained in:
parent
22c76841cb
commit
b513d9845e
@ -33,6 +33,8 @@ USER=root
|
|||||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
PIDFILE_DIR=$(dirname $PIDFILE)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Function that starts the daemon/service
|
# Function that starts the daemon/service
|
||||||
#
|
#
|
||||||
@ -44,8 +46,10 @@ do_start()
|
|||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
# 3 if pid file already exist
|
# 3 if pid file already exist
|
||||||
|
|
||||||
mkdir -p /var/run/$NAME
|
if [ ! -d "$PIDFILE_DIR" ] ; then
|
||||||
chown $USER /var/run/$NAME
|
mkdir -p $PIDFILE_DIR
|
||||||
|
chown $USER $PIDFILE_DIR
|
||||||
|
fi
|
||||||
ulimit -n 8192
|
ulimit -n 8192
|
||||||
ulimit -c unlimited
|
ulimit -c unlimited
|
||||||
if [ -f $PIDFILE ]; then
|
if [ -f $PIDFILE ]; then
|
||||||
@ -68,7 +72,9 @@ do_start()
|
|||||||
do_stop()
|
do_stop()
|
||||||
{
|
{
|
||||||
$DAEMON stop
|
$DAEMON stop
|
||||||
rm -f /var/run/$NAME/*
|
if [ -f "$PIDFILE" ] ; then
|
||||||
|
rm -f $PIDFILE
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@ USER=root
|
|||||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
PIDFILE_DIR=$(dirname $PIDFILE)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Function that starts the daemon/service
|
# Function that starts the daemon/service
|
||||||
#
|
#
|
||||||
@ -44,8 +46,10 @@ do_start()
|
|||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
# 3 if pid file already exist
|
# 3 if pid file already exist
|
||||||
|
|
||||||
mkdir -p /var/run/$NAME
|
if [ ! -d "$PIDFILE_DIR" ] ; then
|
||||||
chown $USER /var/run/$NAME
|
mkdir -p $PIDFILE_DIR
|
||||||
|
chown $USER $PIDFILE_DIR
|
||||||
|
fi
|
||||||
ulimit -n 8192
|
ulimit -n 8192
|
||||||
if [ -f $PIDFILE ]; then
|
if [ -f $PIDFILE ]; then
|
||||||
return 3
|
return 3
|
||||||
@ -74,7 +78,9 @@ do_stop()
|
|||||||
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
rm -f /var/run/$NAME/*
|
if [ -f "$PIDFILE" ] ; then
|
||||||
|
rm -f $PIDFILE
|
||||||
|
fi
|
||||||
return "$RETVAL"
|
return "$RETVAL"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@ USER=zuul
|
|||||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
PIDFILE_DIR=$(dirname $PIDFILE)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Function that starts the daemon/service
|
# Function that starts the daemon/service
|
||||||
#
|
#
|
||||||
@ -44,8 +46,10 @@ do_start()
|
|||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
# 3 if pid file already exist
|
# 3 if pid file already exist
|
||||||
|
|
||||||
mkdir -p /var/run/$NAME
|
if [ ! -d "$PIDFILE_DIR" ] ; then
|
||||||
chown $USER /var/run/$NAME
|
mkdir -p $PIDFILE_DIR
|
||||||
|
chown $USER $PIDFILE_DIR
|
||||||
|
fi
|
||||||
ulimit -n 8192
|
ulimit -n 8192
|
||||||
if [ -f $PIDFILE ]; then
|
if [ -f $PIDFILE ]; then
|
||||||
return 3
|
return 3
|
||||||
@ -74,7 +78,9 @@ do_stop()
|
|||||||
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
rm -f /var/run/$NAME/*
|
if [ -f "$PIDFILE" ] ; then
|
||||||
|
rm -f $PIDFILE
|
||||||
|
fi
|
||||||
return "$RETVAL"
|
return "$RETVAL"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@ USER=zuul
|
|||||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
PIDFILE_DIR=$(dirname $PIDFILE)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Function that starts the daemon/service
|
# Function that starts the daemon/service
|
||||||
#
|
#
|
||||||
@ -44,8 +46,10 @@ do_start()
|
|||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
# 3 if pid file exits already
|
# 3 if pid file exits already
|
||||||
|
|
||||||
mkdir -p /var/run/$NAME
|
if [ ! -d "$PIDFILE_DIR" ] ; then
|
||||||
chown $USER /var/run/$NAME
|
mkdir -p $PIDFILE_DIR
|
||||||
|
chown $USER $PIDFILE_DIR
|
||||||
|
fi
|
||||||
ulimit -n 8192
|
ulimit -n 8192
|
||||||
if [ -f $PIDFILE ]; then
|
if [ -f $PIDFILE ]; then
|
||||||
return 3
|
return 3
|
||||||
@ -74,7 +78,9 @@ do_stop()
|
|||||||
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
rm -f /var/run/$NAME/*
|
if [ -f "$PIDFILE" ] ; then
|
||||||
|
rm -f $PIDFILE
|
||||||
|
fi
|
||||||
return "$RETVAL"
|
return "$RETVAL"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,8 @@ USER=zuul
|
|||||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||||
. /lib/lsb/init-functions
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
PIDFILE_DIR=$(dirname $PIDFILE)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Function that starts the daemon/service
|
# Function that starts the daemon/service
|
||||||
#
|
#
|
||||||
@ -44,8 +46,10 @@ do_start()
|
|||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
# 3 if pid file already exist
|
# 3 if pid file already exist
|
||||||
|
|
||||||
mkdir -p /var/run/$NAME
|
if [ ! -d "$PIDFILE_DIR" ] ; then
|
||||||
chown $USER /var/run/$NAME
|
mkdir -p $PIDFILE_DIR
|
||||||
|
chown $USER $PIDFILE_DIR
|
||||||
|
fi
|
||||||
ulimit -n 8192
|
ulimit -n 8192
|
||||||
if [ -f $PIDFILE ]; then
|
if [ -f $PIDFILE ]; then
|
||||||
return 3
|
return 3
|
||||||
@ -74,7 +78,9 @@ do_stop()
|
|||||||
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
start-stop-daemon --stop --signal 9 --pidfile $PIDFILE
|
||||||
RETVAL="$?"
|
RETVAL="$?"
|
||||||
[ "$RETVAL" = 2 ] && return 2
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
rm -f /var/run/$NAME/*
|
if [ -f "$PIDFILE" ] ; then
|
||||||
|
rm -f $PIDFILE
|
||||||
|
fi
|
||||||
return "$RETVAL"
|
return "$RETVAL"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user