aboutsummaryrefslogtreecommitdiffstats
path: root/testing/kannel/kannel.initd
blob: ddb5c7a13a8673475d42e2abd49f66b0149334df (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/sbin/openrc-run

depend() { 
	need net 
	after mysql postgresql sshd
}

checkconfig() {
	if [ ! -f /etc/kannel/kannel.conf ] ; then
		eerror "/etc/kannel/kannel.conf file doesn't exists!"
		return 1
	fi
	#set the location of logs
	if ! cd /var/log/kannel ; then
		eerror "/var/log/kannel directory doesn't exists!"
		return 1
	fi
}

start() {
	checkconfig || return 1

	einfo "Starting Kannel"
	ebegin " - Bearer Box"
	start-stop-daemon --start --quiet --chuid kannel --exec /usr/sbin/bearerbox \
		--background -- $BEARERBOX_OPTS /etc/kannel/kannel.conf
	eend $? || return 1

	if [ "$START_SMSBOX" = "yes" ] ; then
		ebegin " - SMS Box" 
		start-stop-daemon --start --quiet --chuid kannel --exec /usr/sbin/smsbox \
			--background -- $SMSBOX_OPTS /etc/kannel/kannel.conf
		eend $?
	fi

	if [ "$START_WAPBOX" = "yes" ] ; then
		ebegin " - WAP Box" 
		start-stop-daemon --start --quiet --chuid kannel --exec /usr/sbin/wapbox \
			--background -- $WAPBOX_OPTS /etc/kannel/kannel.conf
		eend $?
	fi

	return 0
}

stop() {
	if [ "$START_WAPBOX" = "yes" ] ; then
		einfo "Stopping Kannel" 
		ebegin " - WAP Box"
		start-stop-daemon --stop --quiet --exec /usr/sbin/wapbox
		eend $?
	fi

	if [ "$START_SMSBOX" = "yes" ] ; then
		ebegin " - SMS Box"
		start-stop-daemon --stop --quiet --exec /usr/sbin/smsbox
		eend $?
	fi

	ebegin " - Bearer Box" 
	start-stop-daemon --stop --quiet --exec /usr/sbin/bearerbox
	eend $?
	
	#stopping any other processes owned by kannel user
	start-stop-daemon --stop --quiet --user kannel
	
	return 0
}