From c5123f398236540a572be28fb9c8e2fd09ca7eea Mon Sep 17 00:00:00 2001 From: Adam Spiers Date: Mon, 23 Feb 2015 15:28:39 +0000 Subject: [PATCH] CLEANUP: extract temporary $LOCKFILE to eliminate duplication Signed-off-by: Adam Spiers --- examples/haproxy.init | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/haproxy.init b/examples/haproxy.init index 2bed3eb3df..67268ebf17 100644 --- a/examples/haproxy.init +++ b/examples/haproxy.init @@ -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.