summaryrefslogtreecommitdiffstats
path: root/network/aiccu/rc.aiccu
blob: 3078f12a01507457d7bfe83dc96f2f5dd0dcc269 (plain)
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
#! /bin/sh
#
# /etc/init.d/aiccu: start / stop AICCU
#
# Jeroen Massar <jeroen@sixxs.net>

NAME=aiccu
DAEMON=/usr/sbin/${NAME}
DESC="SixXS Automatic IPv6 Connectivity Client Utility (${NAME})"

test -x $DAEMON || exit 1

. /etc/init.d/functions

# Verify that the configuration file exists
if [ ! -f /etc/aiccu.conf ]; then
	echo "AICCU Configuration file /etc/aiccu.conf doesn't exist"
	exit 1;
fi

# Verify that the configuration is correct
if [ `grep -c "^username" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
	echo "AICCU is not configured, edit /etc/aiccu.conf first"
	exit 1;
fi

# Verify that it is in daemonize mode, otherwise it won't ever return
if [ `grep -c "^daemonize true" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
	echo "AICCU is not configured to daemonize on run"
	exit 1;
fi

case "$1" in
  start)
	echo "Starting $DESC..."
	$DAEMON start /etc/aiccu.conf
	;;
  stop)
	echo "Stopping $DESC..."
	$DAEMON stop /etc/aiccu.conf
	;;
  restart|reload|force-reload)
	echo "Restarting $DESC..."
	$DAEMON stop /etc/aiccu.conf
	sleep 2
	$DAEMON start /etc/aiccu.conf
	;;
  *)
	echo "Usage: /etc/rc.d/rc.$NAME {start|stop|reload|force-reload|restart}" >&2
	exit 1
esac

exit 0