1a14a838ea
The current script (S51sysrepo-plugind) is not able to stop the daemon. Possible options to fix the problem: A) By adding the "-m -p $PIDFILE" option to start the pid file will be created but it will not contain the correct PID used by the daemon. This is obviously because the daemon forks. B) By not starting the daemon in background (sysrepo-plugind -d) and let do it by start-stop-daemon with "-b" option. But then the log messages of the daemon will not longer ends in the syslog but to stderr. C) Start the daemon without a pidfile and stop the daemon with the "-x" option. The only valid option is C to fix that. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> [yann.morin.1998@free.fr: introduce EXECUTABLE] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
54 lines
804 B
Bash
54 lines
804 B
Bash
#!/bin/sh
|
|
|
|
DAEMON="sysrepo-plugind"
|
|
EXECUTABLE="/usr/bin/$DAEMON"
|
|
|
|
SYSREPO_PLUGIND_ARGS=""
|
|
|
|
# shellcheck source=/dev/null
|
|
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
|
|
|
|
start() {
|
|
printf 'Starting %s: ' "$DAEMON"
|
|
start-stop-daemon -S -q -x "$EXECUTABLE" \
|
|
-- $SYSREPO_PLUGIND_ARGS
|
|
status=$?
|
|
if [ "$status" -eq 0 ]; then
|
|
echo "OK"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
return "$status"
|
|
}
|
|
|
|
stop() {
|
|
printf 'Stopping %s: ' "$DAEMON"
|
|
start-stop-daemon -K -q -x "$EXECUTABLE"
|
|
status=$?
|
|
if [ "$status" -eq 0 ]; then
|
|
echo "OK"
|
|
else
|
|
echo "FAIL"
|
|
fi
|
|
return "$status"
|
|
}
|
|
|
|
restart() {
|
|
stop
|
|
sleep 1
|
|
start
|
|
}
|
|
|
|
reload() {
|
|
# we do not support real reload .. just restart
|
|
restart
|
|
}
|
|
|
|
case "$1" in
|
|
start|stop|restart|reload)
|
|
"$1";;
|
|
*)
|
|
echo "Usage: $0 {start|stop|restart|reload}"
|
|
exit 1
|
|
esac
|