CLEANUP: extract temporary $PIDFILE to eliminate duplication
Signed-off-by: Adam Spiers <aspiers@suse.com>
This commit is contained in:
parent
85bb5ca39b
commit
922a37b2fb
|
@ -37,6 +37,8 @@ BIN=/usr/sbin/$BASENAME
|
||||||
CFG=/etc/$BASENAME/$BASENAME.cfg
|
CFG=/etc/$BASENAME/$BASENAME.cfg
|
||||||
[ -f $CFG ] || exit 1
|
[ -f $CFG ] || exit 1
|
||||||
|
|
||||||
|
PIDFILE=/var/run/$BASENAME.pid
|
||||||
|
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
|
@ -47,7 +49,7 @@ start() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "Starting $BASENAME: "
|
echo -n "Starting $BASENAME: "
|
||||||
daemon $BIN -D -f $CFG -p /var/run/$BASENAME.pid
|
daemon $BIN -D -f $CFG -p $PIDFILE
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
|
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
|
||||||
|
@ -60,7 +62,7 @@ stop() {
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
echo
|
echo
|
||||||
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASENAME
|
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASENAME
|
||||||
[ $RETVAL -eq 0 ] && rm -f /var/run/$BASENAME.pid
|
[ $RETVAL -eq 0 ] && rm -f $PIDFILE
|
||||||
return $RETVAL
|
return $RETVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +82,7 @@ reload() {
|
||||||
echo "Errors found in configuration file, check it with '$BASENAME check'."
|
echo "Errors found in configuration file, check it with '$BASENAME check'."
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
$BIN -D -f $CFG -p /var/run/$BASENAME.pid -sf $(cat /var/run/$BASENAME.pid)
|
$BIN -D -f $CFG -p $PIDFILE -sf $(cat $PIDFILE)
|
||||||
}
|
}
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
|
|
Loading…
Reference in New Issue