]>
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 \ | |
edb55880 | 9 | # some WML content from a web server and compile it into \ |
10 | # WMLC mobile phone bytecode. | |
abc1dfe6 | 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 | ||
edb55880 | 40 | RETVAL=0 |
abc1dfe6 | 41 | # See how we were called. |
42 | case "$1" in | |
edb55880 | 43 | start) |
abc1dfe6 | 44 | if [ ! -f /var/lock/subsys/kannel ]; then |
45 | msg_starting "Kannel gateway (bearerbox)" | |
46 | daemon "$STARTER" /usr/sbin/bearerbox -- $CONFIGFILE | |
47 | RETVAL1=$? | |
48 | msg_starting "Kannel gateway (wapbox)" | |
49 | daemon "$STARTER" /usr/sbin/wapbox -- $CONFIGFILE | |
50 | RETVAL2=$? | |
51 | [ $RETVAL1 -eq 0 -a $RETVAL2 -eq 0 ] && touch /var/lock/subsys/kannel ||\ | |
52 | RETVAL=1 | |
53 | else | |
58cf9876 | 54 | msg_already_running "Kannel gateway" |
abc1dfe6 | 55 | fi |
edb55880 | 56 | ;; |
57 | stop) | |
58 | if [ -f /var/lock/subsys/kannel ]; then | |
abc1dfe6 | 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 | fi |
65 | ;; | |
66 | status) | |
edb55880 | 67 | status kannel |
58cf9876 | 68 | exit $? |
abc1dfe6 | 69 | ;; |
edb55880 | 70 | restart|force-reload) |
71 | $0 stop | |
72 | $0 start | |
73 | ;; | |
74 | *) | |
75 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
76 | exit 3 | |
abc1dfe6 | 77 | esac |
78 | ||
79 | exit $RETVAL |