]> git.pld-linux.org Git - packages/kannel.git/blob - kannel.init
- doesn't work
[packages/kannel.git] / kannel.init
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
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
37
38 STARTER="/usr/sbin/run_kannel_box"
39
40 RETVAL=0
41 # See how we were called.
42 case "$1" in
43   start)
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
54                 msg_already_running "Kannel gateway"
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
63                 msg_not_running "Kannel gateway"
64         fi      
65         ;;
66   status)
67         status kannel
68         exit $?
69         ;;
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
77 esac
78
79 exit $RETVAL
This page took 0.201533 seconds and 3 git commands to generate.