aboutsummaryrefslogtreecommitdiff
path: root/net/respondd/files/respondd.init
blob: b17e4b5cb449629022af45f2e620a036c17264ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/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
}