Skip to content
Snippets Groups Projects
Commit d8bb9783 authored by Jan-Philipp Litza's avatar Jan-Philipp Litza
Browse files

gluon-respondd: Use procd in initscript and to restart on network changes

parent cb86fce2
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
. /lib/functions/service.sh
ifname_to_dev () {
ifstatus client "$1"|jsonfilter -e "@.device"
}
case "$ACTION" in
ifup)
DEVICE="$(ifname_to_dev "$INTERFACE")"
[ "$DEVICE" != "$(cat /lib/gluon/respondd/client.dev 2>/dev/null)" ] ||
/etc/init.d/gluon-respondd restart_if_running &
;;
esac
#!/bin/sh /etc/rc.common #!/bin/sh /etc/rc.common
EXTRA_COMMANDS='restart_if_running' USE_PROCD=1
START=50 START=50
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1
DAEMON=/usr/bin/respondd DAEMON=/usr/bin/respondd
LOCK=/var/run/gluon-respondd.lock
do_start() { start_service() {
DEVS="" DEVS=""
for dev in $( ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device") $(cat /lib/gluon/respondd/client.dev 2>/dev/null) for dev in $( ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device") $(cat /lib/gluon/respondd/client.dev 2>/dev/null)
do do
DEVS="$DEVS -i $dev" DEVS="$DEVS -i $dev"
done done
service_start $DAEMON -g ff02::2:1001 -p 1001 -d /lib/gluon/respondd $DEVS 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}
do_stop() { procd_set_param stderr 1
service_stop $DAEMON procd_close_instance
} }
start() { service_triggers() {
lock $LOCK local script=$(readlink "$initscript")
do_start local name=$(basename ${script:-$initscript})
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 procd_open_trigger
procd_add_raw_trigger "interface.*" 0 "/etc/init.d/$name" reload
procd_close_trigger
} }
#!/bin/sh
/etc/init.d/gluon-respondd restart_if_running &
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment