summaryrefslogtreecommitdiff
path: root/security/tinc/files/tincd.sh.in
blob: 96c38d7d02adfde2024352f1e2087e731d8500db (plain) (blame)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh
#

# PROVIDE: tincd
# REQUIRE: ipfilter FILESYSTEMS sysctl netif
# BEFORE:  SERVERS routing
# KEYWORD: nojail

# Define these tincd_* variables in one of these files:
#	/etc/rc.conf
#	/etc/rc.conf.local
#	/etc/rc.conf.d/threeproxy
#
# DO NOT CHANGE THESE DEFAULT VALUES HERE

tincd_enable=${tincd_enable:-"NO"}

. /etc/rc.subr

name="tincd"
rcvar="tincd_enable"
command="%%PREFIX%%/sbin/tincd"
start_cmd="tincd_start"
stop_cmd="tincd_stop"
reload_cmd="tincd_reload"
extra_commands="reload"
procname=${command:-tincd}

load_rc_config $name

tincd_start()
{
	if test -z "${tincd_cfg}"
	then
		echo "Starting tincd"
		$command
	else
		for cfg in ${tincd_cfg}
		do
			echo "Starting tincd for: ${cfg}"
			$command -n $cfg
		done
	fi
# code deliberately borrowed from /etc/rc.d/netif
	if [ -f /etc/rc.d/ipfilter ] ; then
		# Resync ipfilter
		/etc/rc.d/ipfilter quietresync
	fi
}
tincd_stop()
{
	if test -z "${tincd_cfg}"
	then
		echo "Stopping tincd"
		$command -k
	else
		echo "Stopping tincd for: "
		for cfg in $tincd_cfg
		do
			echo "Stopping tincd for: ${cfg}"
			$command -n $cfg -k
		done
	fi
}
tincd_reload()
{
	if test -z "${tincd_cfg}"
	then
		echo "Sending HUP to tincd"
		$command --kill=HUP
	else
		for cfg in $tincd_cfg
		do
			echo "Sending HUP to tincd for: ${cfg}"
			$command -n $cfg --kill=HUP
		done
	fi
}

run_rc_command "$1"
# eof