4
# Required-Start: $local_fs $remote_fs $syslog $network $time $named
5
# Required-Stop: $local_fs $remote_fs $syslog $network $time $named
6
# Default-Start: 2 3 4 5
8
# Short-Description: SixXS Automatic IPv6 Connectivity Client Utility
10
# This client configures IPv6 connectivity without having to
11
# manually configure interfaces etc. A SixXS account or an account
12
# of another supported tunnel broker and at least one tunnel are
13
# required. These can be freely requested from the SixXS website
14
# at no cost. For more information about SixXS check their homepage.
17
# Original Author: Jeroen Massar <jeroen@sixxs.net>
18
# Author: Reinier Haasjes <reinier@haasjes.com>
23
# PATH should only include /usr/* if it runs after the mountnfs.sh script
24
PATH=/sbin:/usr/sbin:/bin:/usr/bin
25
DESC="SixXS Automatic IPv6 Connectivity Client Utility"
27
DAEMON=/usr/sbin/$NAME
29
PIDFILE=/var/run/$NAME.pid
30
SCRIPTNAME=/etc/init.d/$NAME
32
# Exit if the package is not installed
33
[ -x "$DAEMON" ] || exit 0
35
# Read configuration variable file if it is present
36
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
38
# Load the VERBOSE setting and other rcS variables
41
# Define LSB log_* functions.
42
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
43
. /lib/lsb/init-functions
46
case "$AICCU_ENABLED" in
53
# Function that starts the daemon/service
57
# Verify that the configuration file exists
58
if [ ! -f /etc/aiccu.conf ]; then
59
log_failure_msg "AICCU Configuration file /etc/aiccu.conf doesn't exist"
63
# Verify that the configuration is correct
64
if [ `grep -c "^username" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
65
log_failure_msg "AICCU is not configured, edit /etc/aiccu.conf first"
69
# Verify that it is in daemonize mode, otherwise it won't ever return
70
if [ `grep -c "^daemonize true" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
71
log_failure_msg "AICCU is not configured to daemonize on run"
76
# 0 if daemon has been started
77
# 1 if daemon was already running
78
# 2 if daemon could not be started
79
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
81
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- start \
84
# Add code here, if necessary, that waits for the process to be ready
85
# to handle requests from services started subsequently which depend
86
# on this one. As a last resort, sleep for some time.
90
# Function that stops the daemon/service
95
# 0 if daemon has been stopped
96
# 1 if daemon was already stopped
97
# 2 if daemon could not be stopped
98
# other if a failure occurred
99
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
101
[ "$RETVAL" = 2 ] && return 2
102
# Wait for children to finish too if this is a daemon that forks
103
# and if the daemon is only ever run from this initscript.
104
# If the above conditions are not satisfied then add some other code
105
# that waits for the process to drop all resources that could be
106
# needed by services started subsequently. A last resort is to
107
# sleep for some time.
108
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON -- stop
109
[ "$?" = 2 ] && return 2
110
# Many daemons don't delete their pidfiles when they exit.
117
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
120
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
121
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
125
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
128
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
129
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
133
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
135
restart|force-reload)
137
# If the "reload" option is implemented then remove the
138
# 'force-reload' alias
140
log_daemon_msg "Restarting $DESC" "$NAME"
147
1) log_end_msg 1 ;; # Old process is still running
148
*) log_end_msg 1 ;; # Failed to start
158
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2