CLEANUP: extract temporary $LOCKFILE to eliminate duplication

Signed-off-by: Adam Spiers <aspiers@suse.com>
This commit is contained in:
Adam Spiers 2015-02-23 15:28:39 +00:00 committed by Willy Tarreau
parent 922a37b2fb
commit c5123f3982

View File

@ -38,6 +38,7 @@ CFG=/etc/$BASENAME/$BASENAME.cfg
[ -f $CFG ] || exit 1
PIDFILE=/var/run/$BASENAME.pid
LOCKFILE=/var/lock/subsys/$BASENAME
RETVAL=0
@ -52,7 +53,7 @@ start() {
daemon $BIN -D -f $CFG -p $PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
[ $RETVAL -eq 0 ] && touch $LOCKFILE
return $RETVAL
}
@ -61,7 +62,7 @@ stop() {
killproc $BASENAME -USR1
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASENAME
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
[ $RETVAL -eq 0 ] && rm -f $PIDFILE
return $RETVAL
}
@ -94,7 +95,7 @@ rhstatus() {
}
condrestart() {
[ -e /var/lock/subsys/$BASENAME ] && restart || :
[ -e $LOCKFILE ] && restart || :
}
# See how we were called.