kumquat-buildroot/package/mrouted/S41mrouted
Joachim Wiberg c25115daf2 package/mrouted: add sysv init script
The upstream mrouted package comes with its own systemd unit file, but
no SysV init script.  This script is a modified copy of the sysklogd
init script, but set to start after networking.

Note: for mrouted to start it requires at least two MULTICAST capable
      interfaces that are UP.  This is why an added startup delay of 30
      seconds (-w 30) was added, in case the system has DHCP enabled.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-01-23 21:42:15 +01:00

63 lines
1020 B
Bash
Executable File

#!/bin/sh
DAEMON="mrouted"
PIDFILE="/var/run/$DAEMON.pid"
MROUTED_ARGS="-w 30"
# 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 "/sbin/$DAEMON" \
-- $MROUTED_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"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
restart() {
stop
sleep 1
start
}
# SIGHUP makes mrouted reload its configuration
reload() {
printf 'Reloading %s: ' "$DAEMON"
start-stop-daemon -K -s HUP -q -p "$PIDFILE"
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