gluon/package/gluon-respondd/files/etc/init.d/gluon-respondd
Jan-Philipp Litza fcf3abd9c4 gluon-respondd: restart on state change of client iface
Because we unconditionally appended `-i br-client` to the command line of
respondd, it wasn't restarted when br-client changed state. Now, we use a
jsonfilter expression on the network.interface dump data, similar to how the
other interface names are generated, and only add the interface to the argument
list if it is up.
2016-12-09 10:43:24 +01:00

31 lines
835 B
Bash
Executable File

#!/bin/sh /etc/rc.common
USE_PROCD=1
START=50
DAEMON=/usr/bin/respondd
start_service() {
DEVS=""
for dev in $( ubus call network.interface dump | jsonfilter \
-e "@.interface[@.proto='gluon_mesh' && @.up=true].device" \
-e "@.interface[@.interface='$(cat /lib/gluon/respondd/client.dev 2>/dev/null)' && @.up=true].device")
do
DEVS="$DEVS -i $dev"
done
procd_open_instance
procd_set_param command $DAEMON -g ff02::2:1001 -p 1001 -d /lib/gluon/respondd $DEVS
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
procd_set_param stderr 1
procd_close_instance
}
service_triggers() {
local script=$(readlink "$initscript")
local name=$(basename ${script:-$initscript})
procd_open_trigger
procd_add_raw_trigger "interface.*" 0 "/etc/init.d/$name" reload
procd_close_trigger
}