Added
Link Here
|
1 |
#!/sbin/runscript |
2 |
# Copyright 1999-2004 Gentoo Foundation |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd,v 1.5 2008/04/01 14:08:45 dragonheart Exp $ |
5 |
|
6 |
opts="reload" |
7 |
|
8 |
depend() { |
9 |
use logger dns |
10 |
need net |
11 |
} |
12 |
|
13 |
checkconfig() { |
14 |
if ! grep -q '^ *NETWORK:' /etc/conf.d/tinc.networks |
15 |
then |
16 |
eerror "No VPN networks configured in /etc/conf.d/tinc.networks" |
17 |
return 1 |
18 |
fi |
19 |
} |
20 |
|
21 |
start() { |
22 |
checkconfig || return 1 |
23 |
ebegin "Starting tinc VPN networks" |
24 |
eend 0 |
25 |
awk '/^ *NETWORK:/ { print $2 }' /etc/conf.d/tinc.networks | while read TINCNET |
26 |
do |
27 |
if [ ! -f /etc/tinc/"$TINCNET"/tinc.conf ] |
28 |
then |
29 |
eerror "Cannot start network $TINCNET, /etc/tinc/$TINCNET/tinc.conf does not exist !" |
30 |
else |
31 |
ebegin "Starting tinc network $TINCNET" |
32 |
/usr/sbin/tincd --net="$TINCNET" --logfile=/var/log/tinc.$TINCNET.log --pidfile=/var/run/tinc.$TINCNET.pid |
33 |
eend $? |
34 |
fi |
35 |
done |
36 |
} |
37 |
|
38 |
stop() { |
39 |
ebegin "Stopping tinc VPN networks" |
40 |
eend 0 |
41 |
awk '/^ *NETWORK:/ { print $2 }' /etc/conf.d/tinc.networks | while read TINCNET |
42 |
do |
43 |
if [ -f /var/run/tinc."$TINCNET".pid ] |
44 |
then |
45 |
ebegin "Stopping tinc network $TINCNET" |
46 |
/usr/sbin/tincd --kill --pidfile=/var/run/tinc."$TINCNET".pid |
47 |
eend $? |
48 |
fi |
49 |
done |
50 |
} |
51 |
|
52 |
reload() { |
53 |
ebegin "Reloading configuration for tinc VPN networks" |
54 |
eend 0 |
55 |
awk '/^ *NETWORK:/ { print $2 }' /etc/conf.d/tinc.networks | while read TINCNET |
56 |
do |
57 |
if [ -f /var/run/tinc."$TINCNET".pid ] |
58 |
then |
59 |
ebegin "Reloading tinc network $TINCNET" |
60 |
/usr/sbin/tincd --kill HUP --pidfile=/var/run/tinc."$TINCNET".pid |
61 |
eend $? |
62 |
fi |
63 |
done |
64 |
} |