]>
Commit | Line | Data |
---|---|---|
abc1dfe6 | 1 | #!/bin/sh |
2 | # | |
3 | # kannel: This shell script takes care of starting and stopping | |
4 | # the Kannel WAP gateway | |
5 | # | |
6 | # Author: Maciej Witkowiak <ytm@elysium.pl> | |
7 | # chkconfig: 345 97 03 | |
8 | # description: start and stop the Kannel WAP gateway used to fetch \ | |
9 | # some WML content from a web server and compile it into \ | |
10 | # WMLC mobile phone bytecode. | |
11 | # processname: bearerbox | |
12 | # config: /etc/sysconfig/kannel | |
13 | ||
14 | # Sanity checks. | |
15 | [ -x /usr/sbin/bearerbox ] || exit 0 | |
16 | [ -x /usr/sbin/wapbox ] || exit 0 | |
17 | ||
18 | # Source function library. | |
19 | . /etc/rc.d/init.d/functions | |
20 | ||
21 | # Source network configuration | |
22 | . /etc/sysconfig/network | |
23 | ||
24 | # Get service config | |
25 | CONFIGFILE=/etc/kannel/kannel.conf | |
26 | [ -f /etc/sysconfig/kannel ] && . /etc/sysconfig/kannel | |
27 | ||
28 | # Check that networking is up | |
58cf9876 | 29 | if is_yes "${NETWORKING}"; then |
30 | if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status -a "$1" != init ]; then | |
31 | msg_network_down Kannel | |
32 | exit 1 | |
33 | fi | |
34 | else | |
35 | exit 0 | |
36 | fi | |
abc1dfe6 | 37 | |
38 | STARTER="/usr/sbin/run_kannel_box" | |
39 | ||
40 | # See how we were called. | |
41 | case "$1" in | |
42 | start) | |
43 | if [ ! -f /var/lock/subsys/kannel ]; then | |
44 | msg_starting "Kannel gateway (bearerbox)" | |
45 | daemon "$STARTER" /usr/sbin/bearerbox -- $CONFIGFILE | |
46 | RETVAL1=$? | |
47 | msg_starting "Kannel gateway (wapbox)" | |
48 | daemon "$STARTER" /usr/sbin/wapbox -- $CONFIGFILE | |
49 | RETVAL2=$? | |
50 | [ $RETVAL1 -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/kannel ||\ | |
51 | RETVAL=1 | |
52 | else | |
58cf9876 | 53 | msg_already_running "Kannel gateway" |
abc1dfe6 | 54 | exit 1 |
55 | fi | |
56 | ;; | |
57 | stop) | |
58 | if [ -f /var/lock/subsys/kannel ]; then | |
59 | msg_stopping "Kannel gateway" | |
60 | killproc "$STARTER" | |
61 | rm -f /var/lock/subsys/kannel >/dev/null 2>&1 | |
62 | else | |
58cf9876 | 63 | msg_not_running "Kannel gateway" |
abc1dfe6 | 64 | exit 1 |
65 | fi | |
66 | ;; | |
67 | status) | |
68 | status kannel | |
58cf9876 | 69 | exit $? |
abc1dfe6 | 70 | ;; |
71 | restart|reload) | |
72 | $0 stop | |
73 | $0 start | |
74 | ;; | |
75 | *) | |
58cf9876 | 76 | msg_usage "$0 {start|stop|status|restart|reload}" |
77 | exit 3 | |
abc1dfe6 | 78 | ;; |
79 | esac | |
80 | ||
81 | exit $RETVAL |