summaryrefslogtreecommitdiffstats
path: root/main/tinc/tincd.lo.initd
blob: 79c185b3810f927cae2f55354a83ac371e5a1a2d (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
#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd.lo,v 1.1 2010/07/18 10:04:56 dragonheart Exp $

opts="reload"

depend()
{
	use logger dns
	need net
}

start()
{
	TINCNET=${RC_SVCNAME#*.}
	if [ -f /etc/tinc/"$TINCNET"/tinc.conf ] ; then
		ebegin "Starting tinc network $TINCNET"
		/usr/sbin/tincd --debug=1 --net="$TINCNET" --logfile=/var/log/tinc.$TINCNET.log --pidfile=/var/run/tinc.$TINCNET.pid
		eend $?
	else
		eerror "Cannot start network $TINCNET, /etc/tinc/$TINCNET/tinc.conf does not exist !"
	fi
}

stop()
{
	TINCNET=${RC_SVCNAME#*.}
	if [ -f /var/run/tinc."$TINCNET".pid ] ; then
		ebegin "Stopping tinc network $TINCNET"
		/usr/sbin/tincd --kill --pidfile=/var/run/tinc."$TINCNET".pid
		eend $?
	else
		eerror "Cannot start network $TINCNET, /etc/tinc/$TINCNET/tinc.conf does not exist !"
	fi
}

reload()
{
	TINCNET=${RC_SVCNAME#*.}
	if [ -f /var/run/tinc."$TINCNET".pid ] ; then
		ebegin "Reloading configuration for tinc network $TINCNET"
		/usr/sbin/tincd --kill HUP --pidfile=/var/run/tinc."$TINCNET".pid
		eend $?
	fi
}