extras: create PID file for glusterd when started from init scripts
thanks to Jaroslav Pulchart (jaroslav.pulchart@centrum.cz) for the patch Change-Id: Id07bf50536c8638f790f06e6e5994f85555c3978 BUG: 771221 Signed-off-by: Kaushik BV <kbudiger@redhat.com> Reviewed-on: http://review.gluster.com/2668 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
This commit is contained in:
parent
7d81a11e66
commit
9636f5b16c
@ -8,28 +8,46 @@
|
||||
. /etc/rc.d/init.d/functions
|
||||
|
||||
BASE=glusterd
|
||||
PIDFILE=/var/run/$BASE.pid
|
||||
PID=`test -f $PIDFILE && cat $PIDFILE`
|
||||
GLUSTERFSD=glusterfsd
|
||||
GLUSTERFS=glusterfs
|
||||
GLUSTERD_BIN=@prefix@/sbin/$BASE
|
||||
GLUSTERD_OPTS=""
|
||||
GLUSTERD_OPTS="--pid-file=$PIDFILE"
|
||||
GLUSTERD="$GLUSTERD_BIN $GLUSTERD_OPTS"
|
||||
RETVAL=0
|
||||
|
||||
# Start the service $BASE
|
||||
start()
|
||||
{
|
||||
echo -n $"Starting $BASE:"
|
||||
daemon $GLUSTERD
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -ne 0 ] && exit $RETVAL
|
||||
pidofproc -p $PIDFILE $GLUSTERD_BIN &> /dev/null
|
||||
status=$?
|
||||
if [ $status -eq 0 ]; then
|
||||
echo "glusterd service is already running with pid $PID"
|
||||
exit 1
|
||||
else
|
||||
echo -n $"Starting $BASE:"
|
||||
daemon $GLUSTERD
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -ne 0 ] && exit $RETVAL
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Stop the service $BASE
|
||||
stop()
|
||||
{
|
||||
echo -n $"Stopping $BASE:"
|
||||
killproc $BASE
|
||||
pidofproc -p $PIDFILE $GLUSTERD_BIN &> /dev/null
|
||||
status=$?
|
||||
if [ $status -eq 0 ]; then
|
||||
killproc -p $PIDFILE $BASE
|
||||
[ -w $PIDFILE ] && rm -f $PIDFILE
|
||||
else
|
||||
killproc $BASE
|
||||
fi
|
||||
|
||||
echo
|
||||
pidof -c -o %PPID -x $GLUSTERFSD &> /dev/null
|
||||
[ $? -eq 0 ] && killproc $GLUSTERFSD &> /dev/null
|
||||
|
Loading…
x
Reference in New Issue
Block a user