packages/net/respondd/files/respondd.init
David Bauer bbfd3f9709 respondd: add package
This adds the respondd package, a protocol used primarily with Freifunk
and the Gluon mesh-framework for collecting statistics.

For more information, see the project readme.

Ref: https://github.com/freifunk-gluon/respondd/

Tested: mpc85xx-p1020 / mediatek-filogic

Signed-off-by: David Bauer <mail@david-bauer.net>
2023-03-31 12:44:26 +02:00

56 lines
1.1 KiB
Bash

#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
PROG=/usr/bin/respondd
NAME=respondd
multicast_group()
{
config_get group "$1" group
config_get interfaces "$1" interface
config_get disabled "$1" disabled 0
if [ "$disabled" -gt "0" ]; then
return
fi
procd_append_param command -g $group
for iface in "$interfaces"; do
procd_append_param command -i "$iface"
done
}
daemon_settings()
{
config_get port "$1" port
config_get providers "$1" providers
procd_append_param command -p "$port"
procd_append_param command -d "$providers"
}
start_service()
{
. /lib/functions.sh
. /lib/functions/network.sh
procd_open_instance
procd_set_param command "$PROG"
config_load respondd
config_foreach daemon_settings daemon
config_foreach multicast_group multicast-group
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
procd_set_param stderr 1
procd_close_instance
}
service_triggers()
{
procd_add_config_trigger "config.change" "respondd" /etc/init.d/respondd reload
procd_add_interface_trigger "interface.*" 2000 /etc/init.d/respondd reload
}