diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2010-12-10 20:04:19 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2010-12-10 20:04:19 +0000 |
commit | b70d422361400cc6a43c322e9f446dc2b3791504 (patch) | |
tree | 08a86d44c040996449053eaf8f01c1a3754bd3f5 /main/tinc/tincd.initd | |
parent | 0cfedfd014e9681c080967c74baac1290365ae46 (diff) | |
download | aports-b70d422361400cc6a43c322e9f446dc2b3791504.tar.bz2 aports-b70d422361400cc6a43c322e9f446dc2b3791504.tar.xz |
main/tinc: renamed
Diffstat (limited to 'main/tinc/tincd.initd')
-rw-r--r-- | main/tinc/tincd.initd | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/main/tinc/tincd.initd b/main/tinc/tincd.initd new file mode 100644 index 0000000000..452687dfb6 --- /dev/null +++ b/main/tinc/tincd.initd @@ -0,0 +1,64 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd,v 1.5 2008/04/01 14:08:45 dragonheart Exp $ + +opts="reload" + +depend() { + use logger dns + need net +} + +checkconfig() { + if ! grep -q '^ *NETWORK:' /etc/conf.d/tinc.networks + then + eerror "No VPN networks configured in /etc/conf.d/tinc.networks" + return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting tinc VPN networks" + eend 0 + awk '/^ *NETWORK:/ { print $2 }' /etc/conf.d/tinc.networks | while read TINCNET + do + if [ ! -f /etc/tinc/"$TINCNET"/tinc.conf ] + then + eerror "Cannot start network $TINCNET, /etc/tinc/$TINCNET/tinc.conf does not exist !" + else + ebegin "Starting tinc network $TINCNET" + /usr/sbin/tincd --net="$TINCNET" --logfile=/var/log/tinc.$TINCNET.log --pidfile=/var/run/tinc.$TINCNET.pid + eend $? + fi + done +} + +stop() { + ebegin "Stopping tinc VPN networks" + eend 0 + awk '/^ *NETWORK:/ { print $2 }' /etc/conf.d/tinc.networks | while read TINCNET + do + if [ -f /var/run/tinc."$TINCNET".pid ] + then + ebegin "Stopping tinc network $TINCNET" + /usr/sbin/tincd --kill --pidfile=/var/run/tinc."$TINCNET".pid + eend $? + fi + done +} + +reload() { + ebegin "Reloading configuration for tinc VPN networks" + eend 0 + awk '/^ *NETWORK:/ { print $2 }' /etc/conf.d/tinc.networks | while read TINCNET + do + if [ -f /var/run/tinc."$TINCNET".pid ] + then + ebegin "Reloading tinc network $TINCNET" + /usr/sbin/tincd --kill HUP --pidfile=/var/run/tinc."$TINCNET".pid + eend $? + fi + done +} |