aboutsummaryrefslogtreecommitdiffstats
path: root/main/aiccu/aiccu.initd
blob: 1c8dec0105cdcf93e43b8520f6e719ec2e6792e4 (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
#!/sbin/runscript

depend() {
	need net
	after ntpd
}

checkconfig() {
        # Verify that the configuration file exists
        if [ ! -f /etc/aiccu.conf ]; then
        	eerror "AICCU Configuration file /etc/aiccu.conf doesn't exist"
		return 1
        fi
	
        # Verify that the configuration is correct
        if [ `grep -c "^username" /etc/aiccu.conf 2>/dev/null` -ne 1 ]; then
		eerror "AICCU is not configured, edit /etc/aiccu.conf first"
		return 1
	fi
}


start() {
	checkconfig || return 1
	ebegin "Starting aiccu"
	start-stop-daemon --start --quiet --exec /usr/sbin/aiccu -- start
	eend $?
}

stop() {
	ebegin "Stopping aiccu"
	start-stop-daemon --stop --pidfile /var/run/aiccu.pid --quiet --exec /usr/sbin/aiccu -- stop
	eend $?
}

restart() {
	stop
	sleep 3
	start
}