2021-08-30 17:30:55 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
NAME="smcroute"
|
|
|
|
DAEMON="smcrouted"
|
|
|
|
PIDFILE="/var/run/$NAME.pid"
|
|
|
|
|
|
|
|
# shellcheck source=/dev/null
|
|
|
|
[ -r "/etc/default/$NAME" ] && . "/etc/default/$NAME"
|
|
|
|
|
|
|
|
cmd()
|
|
|
|
{
|
2021-09-28 11:43:23 +02:00
|
|
|
start-stop-daemon -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" "$@"
|
2021-08-30 17:30:55 +02:00
|
|
|
status=$?
|
|
|
|
if [ $status -eq 0 ]; then
|
|
|
|
echo "OK"
|
|
|
|
else
|
|
|
|
echo "FAIL"
|
|
|
|
fi
|
|
|
|
return $status
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
printf 'Starting %s: ' "$DAEMON"
|
|
|
|
# shellcheck disable=SC2086 # we need the word splitting
|
2021-09-28 11:43:23 +02:00
|
|
|
cmd -S -- $SMCROUTED_ARGS
|
2021-08-30 17:30:55 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
stop)
|
|
|
|
printf 'Stopping %s: ' "$DAEMON"
|
|
|
|
cmd -K
|
|
|
|
;;
|
|
|
|
|
|
|
|
restart)
|
|
|
|
$0 stop
|
|
|
|
sleep 1
|
|
|
|
$0 start
|
|
|
|
;;
|
|
|
|
|
|
|
|
reload)
|
|
|
|
printf 'Reloading %s: ' "$DAEMON"
|
|
|
|
cmd -K -s HUP
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop|restart|reload}"
|
|
|
|
exit 1
|
|
|
|
esac
|