Imported Upstream version 20070115
[aiccu.git] / doc / aiccu.init
blobf264bc39a2f88038dc64885ede6551885f3f3a73
1 #! /bin/sh
3 # /etc/init.d/aiccu: start / stop AICCU
5 # Jeroen Massar <jeroen@sixxs.net>
7 PATH=/sbin:/bin:/usr/sbin:/usr/bin
8 NAME=aiccu
9 DAEMON=/usr/sbin/${NAME}
10 DESC="SixXS Automatic IPv6 Connectivity Client Utility (${NAME})"
11 BACKGROUND=true
13 # Options
14 OPTIONS=""
16 test -x $DAEMON || exit 0
18 # Verify that the configuration file exists
19 if [ ! -f /etc/aiccu.conf ]; then
20 echo "AICCU Configuration file /etc/aiccu.conf doesn't exist"
21 exit 0;
24 # Verify that the configuration is correct
25 if [ `grep -c "^username" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
26 echo "AICCU is not configured, edit /etc/aiccu.conf first"
27 exit 0;
30 # Verify that it is in daemonize mode, otherwise it won't ever return
31 if [ `grep -c "^daemonize true" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
32 echo "AICCU is not configured to daemonize on run"
33 exit 0;
36 if [ -f /etc/default/${NAME} ]; then
37 . /etc/default/${NAME}
40 if [ "$BACKGROUND" = "false" ]; then
41 exit 0;
44 case "$1" in
45 start)
46 echo -n "Starting $DESC: "
47 start-stop-daemon --start --oknodo --quiet --exec $DAEMON -- start $OPTIONS
48 echo "$NAME."
50 stop)
51 echo -n "Stopping $DESC: "
52 start-stop-daemon --stop --oknodo --quiet --exec $DAEMON -- stop
53 echo "$NAME."
55 restart|reload|force-reload)
56 echo -n "Restarting $DESC: "
57 start-stop-daemon --stop --oknodo --quiet --exec $DAEMON -- stop
58 sleep 2
59 start-stop-daemon --start --oknodo --quiet --exec $DAEMON -- start $OPTIONS
60 echo "$NAME."
63 echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart}" >&2
64 exit 1
65 esac
67 exit 0