File: tspc.init

package info (click to toggle)
tspc 2.1.1-6.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,908 kB
  • ctags: 2,322
  • sloc: ansic: 15,714; sh: 715; makefile: 430
file content (66 lines) | stat: -rw-r--r-- 1,140 bytes parent folder | download
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#! /bin/sh
### BEGIN INIT INFO
# Provides:          tspc
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     S
# Default-Stop:      0 6
# Short-Description: Script to configure the IPv6 tunnel to tspc
### END INIT INFO
#
#	Written by Martin Waitz <tali@debian.org>

PATH=/sbin:/bin:/usr/sbin:/usr/bin
TSPC=/usr/sbin/tspc

test -f $TSPC || exit 0


# read tsp client config, to get the interface used
. /etc/tsp/tspc.conf

start() {
	start-stop-daemon --start --quiet --exec $TSPC || exit 1
}

stop() {
	start-stop-daemon --stop --quiet --exec $TSPC || exit 1
	ip tunnel del $if_tunnel_v6v4 2>/dev/null
	ip tunnel del $if_tunnel_v6udpv6 2>/dev/null
}


case "$1" in
  start)
	echo -n "Setting up IPv6 tunnel: "
	start
	if test "$?" = 0; then
		echo "done.";
	else
		echo "failed."
		exit 1
	fi
	;;
  stop)
	echo -n "Shutting down IPv6 tunnel: "
	stop
	echo "done."
	;;
  restart|force-reload)
	echo -n "Restarting IPv6 tunnel: "
	stop
	start
	if test "$?" = 0; then
		echo "done.";
	else
		echo "failed."
		exit 1
	fi
	;;
  *)
	echo "Usage: $0 {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0