Merge branch 'mw/config'
[aiccu.git] / debian / aiccu.init.d
blob4da159e17b2b2a11dc376e6d7b16aea62cfafe28
1 #! /bin/sh
3 # /etc/init.d/aiccu: start / stop AICCU
5 # Jeroen Massar <jeroen@sixxs.net>
6 exit 0
8 ### BEGIN INIT INFO
9 # Provides: aiccu
10 # Required-Start: $local_fs $remote_fs $network $time $named
11 # Required-Stop: $local_fs $remote_fs $network $time $named
12 # Default-Start: 2 3 4 5
13 # Default-Stop: 0 1 6
14 # Short-Description: SixXS Automatic IPv6 Connectivity Client Utility
15 # Description:
16 # This client configures IPv6 connectivity without having to
17 # manually configure interfaces etc. A SixXS account or an account
18 # of another supported tunnel broker and at least one tunnel are
19 # required. These can be freely requested from the SixXS website
20 # at no cost. For more information about SixXS check their homepage.
21 ### END INIT INFO
23 PATH=/sbin:/bin:/usr/sbin:/usr/bin
24 NAME=aiccu
25 DAEMON=/usr/sbin/${NAME}
26 DESC="SixXS Automatic IPv6 Connectivity Client Utility (${NAME})"
27 BACKGROUND=true
29 # Options
30 OPTIONS=""
32 test -x $DAEMON || exit 0
34 . /lib/lsb/init-functions
36 if [ -f /etc/default/${NAME} ]; then
37 . /etc/default/${NAME}
40 # Verify that the configuration file exists
41 if [ ! -f /etc/aiccu.conf ]; then
42 echo "AICCU Configuration file /etc/aiccu.conf doesn't exist"
43 exit 0;
46 # Verify that the configuration is correct
47 if [ `grep -c "^username" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
48 echo "AICCU is not configured, edit /etc/aiccu.conf first"
49 exit 0;
52 # Verify that it is in daemonize mode, otherwise it won't ever return
53 if [ `grep -c "^daemonize true" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
54 echo "AICCU is not configured to daemonize on run"
55 exit 0;
58 if [ "$BACKGROUND" = "false" ]; then
59 exit 0;
62 case "$1" in
63 start)
64 log_begin_msg "Starting $DESC..."
65 start-stop-daemon --start --oknodo --quiet --exec $DAEMON -- start $OPTIONS
66 log_end_msg $?
68 stop)
69 log_begin_msg "Stopping $DESC..."
70 start-stop-daemon --stop --oknodo --quiet --exec $DAEMON -- stop
71 log_end_msg $?
73 restart|reload|force-reload)
74 log_begin_msg "Restarting $DESC..."
75 start-stop-daemon --stop --oknodo --quiet --exec $DAEMON -- stop
76 sleep 2
77 start-stop-daemon --start --oknodo --quiet --exec $DAEMON -- start $OPTIONS
78 log_end_msg $?
81 echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart}" >&2
82 exit 1
83 esac
85 exit 0