Initial Commit
- initial default booting image
This commit is contained in:
73
package/mdnsd/S50mdnsd
Normal file
73
package/mdnsd/S50mdnsd
Normal file
@@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
|
||||
DAEMON=mdnsd
|
||||
MDNSD=/usr/sbin/$DAEMON
|
||||
PIDFILE=/var/run/$DAEMON.pid
|
||||
CFGFILE=/etc/default/$DAEMON
|
||||
|
||||
MDNSD_ARGS=""
|
||||
|
||||
# Read configuration variable file if it is present
|
||||
# shellcheck source=/dev/null
|
||||
[ -r "$CFGFILE" ] && . "$CFGFILE"
|
||||
|
||||
start() {
|
||||
printf 'Starting %s: ' "$DAEMON"
|
||||
# shellcheck disable=SC2086 # we need word splitting
|
||||
start-stop-daemon --start --pidfile "$PIDFILE" \
|
||||
--exec "$MDNSD" -- $MDNSD_ARGS
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
return "$status"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping %s: " "$DAEMON"
|
||||
start-stop-daemon --stop --pidfile "$PIDFILE" \
|
||||
--exec "$MDNSD"
|
||||
status=$?
|
||||
if [ "$status" -eq 0 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
return "$status"
|
||||
fi
|
||||
# mdnsd deletes its PID file on exit, wait for it to be gone
|
||||
while [ -f "$PIDFILE" ]; do
|
||||
sleep 0.1
|
||||
done
|
||||
return "$status"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
# SIGHUP reloads /etc/mdns.d/*.service
|
||||
reload() {
|
||||
printf 'Reloading %s: ' "$DAEMON"
|
||||
start-stop-daemon --stop --signal HUP -q --pidfile "$PIDFILE" \
|
||||
--exec "$MDNSD"
|
||||
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
|
||||
Reference in New Issue
Block a user