buildroot/package/libvirt/S91virtlogd

66 lines
1.2 KiB
Bash

#!/bin/sh
DAEMON="virtlogd"
EXECFILE="/usr/sbin/$DAEMON"
PIDFILE="/var/run/$DAEMON.pid"
VIRTLOGD_ARGS=""
# shellcheck source=/dev/null
[ -r "/etc/default/$DAEMON" ] && . "/etc/default/$DAEMON"
start() {
printf 'Starting %s: ' "$DAEMON"
# shellcheck disable=SC2086 # we need the word splitting
start-stop-daemon -S -q -p "$PIDFILE" -x "$EXECFILE" \
-- -d $VIRTLOGD_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 -p "$PIDFILE" -x "$EXECFILE"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
# On receipt of SIGUSR1 virtlogd will re-exec() its binary, while maintaining
# all current logs and clients. This allows for live upgrades of the virtlogd
# service.
reload() {
printf 'Reloading %s: ' "$DAEMON"
start-stop-daemon -K -s USR1 -q -p "$PIDFILE" -x "$EXECFILE"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
case "$1" in
start|stop|restart|reload)
"$1";;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac