CLEANUP: extract temporary $BIN to eliminate duplication
Signed-off-by: Adam Spiers <aspiers@suse.com>
diff --git a/examples/haproxy.init b/examples/haproxy.init
index ae3ac0f..938721c 100644
--- a/examples/haproxy.init
+++ b/examples/haproxy.init
@@ -32,20 +32,22 @@
BASENAME=`basename $BASENAME`
fi
+BIN=/usr/sbin/$BASENAME
+
CFG=/etc/$BASENAME/$BASENAME.cfg
[ -f $CFG ] || exit 1
RETVAL=0
start() {
- /usr/sbin/$BASENAME -c -q -f $CFG
+ $BIN -c -q -f $CFG
if [ $? -ne 0 ]; then
echo "Errors found in configuration file, check it with '$BASENAME check'."
return 1
fi
echo -n "Starting $BASENAME: "
- daemon /usr/sbin/$BASENAME -D -f $CFG -p /var/run/$BASENAME.pid
+ daemon $BIN -D -f $CFG -p /var/run/$BASENAME.pid
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
@@ -63,7 +65,7 @@
}
restart() {
- /usr/sbin/$BASENAME -c -q -f $CFG
+ $BIN -c -q -f $CFG
if [ $? -ne 0 ]; then
echo "Errors found in configuration file, check it with '$BASENAME check'."
return 1
@@ -73,16 +75,16 @@
}
reload() {
- /usr/sbin/$BASENAME -c -q -f $CFG
+ $BIN -c -q -f $CFG
if [ $? -ne 0 ]; then
echo "Errors found in configuration file, check it with '$BASENAME check'."
return 1
fi
- /usr/sbin/$BASENAME -D -f $CFG -p /var/run/$BASENAME.pid -sf $(cat /var/run/$BASENAME.pid)
+ $BIN -D -f $CFG -p /var/run/$BASENAME.pid -sf $(cat /var/run/$BASENAME.pid)
}
check() {
- /usr/sbin/$BASENAME -c -q -V -f $CFG
+ $BIN -c -q -V -f $CFG
}
rhstatus() {