aboutsummaryrefslogtreecommitdiff
path: root/net/misc/tinc/rc.tinc.new
diff options
context:
space:
mode:
Diffstat (limited to 'net/misc/tinc/rc.tinc.new')
-rw-r--r--net/misc/tinc/rc.tinc.new58
1 files changed, 58 insertions, 0 deletions
diff --git a/net/misc/tinc/rc.tinc.new b/net/misc/tinc/rc.tinc.new
new file mode 100644
index 0000000..2b8a24b
--- /dev/null
+++ b/net/misc/tinc/rc.tinc.new
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+tinc_networks() {
+
+ for conf in `ls /etc/tinc`; do
+ if [ -e "/etc/tinc/$conf/tinc.conf" ]; then
+ echo $conf
+ fi
+ done
+
+}
+
+tinc_start() {
+ echo "Starting tinc VPN networks"
+ for TINCNET in `tinc_networks`; do
+ echo "Starting tinc network $TINCNET"
+ /usr/sbin/tincd --net="$TINCNET" --logfile=/var/log/tinc.$TINCNET.log --pidfile=/var/run/tinc.$TINCNET.pid
+ done
+}
+
+tinc_stop() {
+ echo "Stopping tinc VPN networks"
+ for TINCNET in `tinc_networks`; do
+ if [ -f /var/run/tinc."$TINCNET".pid ]; then
+ echo "Stopping tinc network $TINCNET"
+ /usr/sbin/tincd --kill --pidfile=/var/run/tinc."$TINCNET".pid
+ fi
+ done
+}
+
+tinc_reload() {
+ echo "Reloading configuration for tinc VPN networks"
+ for TINCNET in `tinc_networks`; do
+ if [ -f /var/run/tinc."$TINCNET".pid ]; then
+ echo "Reloading tinc network $TINCNET"
+ /usr/sbin/tincd --kill HUP --pidfile=/var/run/tinc."$TINCNET".pid
+ fi
+ done
+}
+
+case "$1" in
+'start')
+ tinc_start
+ ;;
+'stop')
+ tinc_stop
+ ;;
+'restart')
+ tinc_stop
+ tinc_start
+ ;;
+'reload')
+ tinc_reload
+ ;;
+*)
+ echo "usage $0 start|stop|restart|reload"
+esac
+