aboutsummaryrefslogtreecommitdiff
path: root/network/miredo/rc.miredo
diff options
context:
space:
mode:
authorFridrich von Stauffenberg <cancellor2@gmail.com>2011-11-12 07:44:37 -0200
committerRobby Workman <rworkman@slackbuilds.org>2011-11-26 09:09:11 -0600
commit6234fdb9cd7062e180b0af55a8475c40f147f1f7 (patch)
treeedc932e0f88c2811963e67a705c1481b4bd397e6 /network/miredo/rc.miredo
parent3bb965a4324775e8d84b54dd79ab57651836066f (diff)
network/miredo: Added (teredo IPv6 tunneling)
Signed-off-by: Niels Horn <niels.horn@slackbuilds.org>
Diffstat (limited to 'network/miredo/rc.miredo')
-rw-r--r--network/miredo/rc.miredo88
1 files changed, 88 insertions, 0 deletions
diff --git a/network/miredo/rc.miredo b/network/miredo/rc.miredo
new file mode 100644
index 0000000000000..0ba5d706efcb8
--- /dev/null
+++ b/network/miredo/rc.miredo
@@ -0,0 +1,88 @@
+#!/bin/sh
+#
+# Miredo - Teredo IPv6 tunnelling
+#
+# Init script for miredo client.
+#
+# Written by Fridrich von Stauffenberg <cancellor2@gmail.com>
+# Based on tor's init script by Marco Bonetti <sid77@slackware.it>
+
+PIDFILE=/var/run/miredo.pid
+DAEMON=/usr/sbin/miredo
+
+miredo_start() {
+ echo "Starting Miredo: $DAEMON"
+ $DAEMON
+}
+
+miredo_stop() {
+ echo -n "Stopping Miredo... "
+ PID=$(cat $PIDFILE 2>/dev/null)
+ if [ -z "$PID" ]; then
+ echo "not running."
+ exit 0
+ fi
+ if kill -15 $PID; then
+ echo "stopped."
+ else
+ sleep 1
+ if kill -9 $PID; then
+ echo "killed."
+ else
+ echo "error!"
+ exit 1
+ fi
+ fi
+}
+
+miredo_reload() {
+ echo -n "Reloading Miredo... "
+ PID=$(cat $PIDFILE 2>/dev/null)
+ if [ -z "$PID" ]; then
+ echo "not running."
+ exit 0
+ fi
+ if kill -1 $PID; then
+ echo "reloaded."
+ else
+ echo "error!"
+ exit 1
+ fi
+}
+
+miredo_status() {
+ PID=$(cat $PIDFILE 2>/dev/null)
+ if [ -z "$PID" ]; then
+ echo "Not running."
+ exit 1
+ elif kill -0 $PID; then
+ echo "Running with PID $PID."
+ exit 0
+ else
+ echo "PID file $PIDFILE present, but PID $PID is not running."
+ exit 1
+ fi
+}
+
+case "$1" in
+ start)
+ miredo_start
+ ;;
+ stop)
+ miredo_stop
+ ;;
+ restart)
+ miredo_stop
+ sleep 1
+ miredo_start
+ ;;
+ reload)
+ miredo_reload
+ ;;
+ status)
+ miredo_status
+ ;;
+ *)
+ echo "Usage: $0 (start|stop|restart|reload|status)"
+ ;;
+esac