-
Notifications
You must be signed in to change notification settings - Fork 16
/
kannel-devel.init
executable file
·109 lines (95 loc) · 2.96 KB
/
kannel-devel.init
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/sh
# Start/stop the Kannel boxes: One bearer box and one WAP box.
# This is the default init.d script for Kannel. Its configuration is
# appropriate for a small site running Kannel on one machine.
# Make sure that the Kannel binaries can be found in $BOXPATH or somewhere
# else along $PATH. run_kannel_box has to be in $BOXPATH.
BOXPATH=/usr/sbin
PIDFILES=/var/run/kannel
CONFDIR=/etc/kannel
CONF=$CONFDIR/kannel.conf
PATH=$BOXPATH:$PATH
# On Debian, the most likely reason for the bearerbox not being available
# is that the package is in the "removed" or "unconfigured" state, and the
# init.d script is still around because it's a conffile. This is normal,
# so don't generate any output.
test -x $BOXPATH/bearerbox || exit 0
test -r /etc/default/kannel-devel && . /etc/default/kannel-devel
case "$1" in
start)
echo -n "Starting WAP gateway:"
echo -n " bearerbox"
start-stop-daemon --start --quiet \
--pidfile $PIDFILES/kannel_bearerbox.pid \
--chuid kannel \
--exec $BOXPATH/run_kannel_box \
-- \
--pidfile $PIDFILES/kannel_bearerbox.pid \
--no-extra-args \
$BOXPATH/bearerbox -v 4 -- $CONF
sleep 1 # Wait for bearerbox
test ! -z $START_WAPBOX && (
echo -n " wapbox"
start-stop-daemon --start --quiet \
--pidfile $PIDFILES/kannel_wapbox.pid \
--chuid kannel \
--exec $BOXPATH/run_kannel_box \
-- \
--pidfile $PIDFILES/kannel_wapbox.pid \
--no-extra-args \
$BOXPATH/wapbox -v 4 -- $CONF
)
test ! -z $START_SMSBOX && (
echo -n " smsbox"
start-stop-daemon --start --quiet \
--pidfile $PIDFILES/kannel_smsbox.pid \
--chuid kannel \
--exec $BOXPATH/run_kannel_box \
-- \
--pidfile $PIDFILES/kannel_smsbox.pid \
--no-extra-args \
$BOXPATH/smsbox -v 4 -- $CONF
)
echo "."
;;
stop)
echo -n "Stopping WAP gateway:"
test ! -z $START_SMSBOX && (
echo -n " smsbox"
start-stop-daemon --stop --retry 5 --quiet \
--pidfile $PIDFILES/kannel_smsbox.pid \
--exec $BOXPATH/run_kannel_box
)
test ! -z $START_WAPBOX && (
echo -n " wapbox"
start-stop-daemon --stop --retry 5 --quiet \
--pidfile $PIDFILES/kannel_wapbox.pid \
--exec $BOXPATH/run_kannel_box
)
echo -n " bearerbox"
start-stop-daemon --stop --retry 5 --quiet \
--pidfile $PIDFILES/kannel_bearerbox.pid \
--exec $BOXPATH/run_kannel_box
echo "."
;;
status)
CORE_CONF=$(grep -r 'group[[:space:]]*=[[:space:]]*core' $CONFDIR | cut -d: -f1)
ADMIN_PORT=$(grep '^admin-port' $CORE_CONF | sed "s/.*=[[:space:]]*//")
ADMIN_PASS=$(grep '^admin-password' $CORE_CONF | sed "s/.*=[[:space:]]*//")
STATUS_URL="http://127.0.0.1:${ADMIN_PORT}/status.txt?password=${ADMIN_PASS}"
lynx -source $STATUS_URL
;;
reload)
# We don't have support for this yet.
exit 1
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|status|restart|force-reload}"
exit 1
esac
exit 0