gluon/package/gluon-respondd/files/etc/init.d/gluon-respondd
Matthias Schiffer b4aaf8a1f8 gluon-respondd: add init script
Instead of starting gluon-respondd from a hotplug handler, add a proper
init script. The new init script has a restart_if_running argument which
is now used by the hotplug handler.
2016-02-02 09:18:13 +01:00

46 lines
636 B
Bash
Executable File

#!/bin/sh /etc/rc.common
EXTRA_COMMANDS='restart_if_running'
START=50
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1
DEVLIST=/var/run/gluon-respondd.devs
DAEMON=/usr/bin/respondd
LOCK=/var/run/gluon-respondd.lock
do_start() {
DEVS=$(cat $DEVLIST 2>/dev/null | while read dev iface; do echo -n " -i $dev"; done)
service_start $DAEMON -g ff02::2:1001 -p 1001 -d /lib/gluon/respondd $DEVS
}
do_stop() {
service_stop $DAEMON
}
start() {
lock $LOCK
do_start
lock -u $LOCK
}
stop() {
lock $LOCK
do_stop
lock -u $LOCK
}
restart_if_running() {
lock $LOCK
if service_check $DAEMON; then
do_stop
do_start
fi
lock -u $LOCK
}