49 lines
714 B
Bash
Executable File
49 lines
714 B
Bash
Executable File
#!/bin/sh /etc/rc.common
|
|
|
|
EXTRA_COMMANDS='restart_if_running'
|
|
|
|
START=50
|
|
|
|
SERVICE_WRITE_PID=1
|
|
SERVICE_DAEMONIZE=1
|
|
|
|
DAEMON=/usr/bin/respondd
|
|
LOCK=/var/run/gluon-respondd.lock
|
|
|
|
|
|
do_start() {
|
|
DEVS=""
|
|
for dev in $( ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device") $(cat /lib/gluon/respondd/client.dev)
|
|
do
|
|
DEVS="$DEVS -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
|
|
}
|