On Thu, Jun 10, 2004 at 03:14:59PM +0800, shwong wrote:
> Hi Guillaume,
> 
> Thanks for your advice. But i've forgotten to mention that the App
> server could telnet into some ports like 80,23 . Does that imply it's
> more of a port access problem?

if kannel is running can you telnet to kannel's port?
if you can get at it from localhost and not from remote then it
 is an access problem .... firewall or is port just being
 opened for local access ?

> 
> I've read that to enable a port accessible through TCP-IP, /etc/services
> and /etc/inetd.conf are the files involved. I've already added these
> lines into /etc/services:
> 
> 
> kannel          13131/tcp                       # Kannel send sms port
> kannel          13131/udp                       # Kannel send sms port

You don't need to do this but perhaps (I don't know) some
 applications or firewalls use /etc/services and this could
 be a good thing in some cases.

> 
> For /etc/inetd.conf, it seemed to need a kannel daemon. Hence it stays
> unedited.
> 
> Would reconfiguring Kannel with --enable-start-stop-daemon help? How
> would i know whether the existing Kannel has this option?

It would not help I think.
Not sure is that daemon needed even when installing kannel as a service.
Attached is /etc/init.d/kannel script I use.
 fits in nicely with redhat 9.1 init.d anyway.

> 
> Can someone point me to the right direction? It's urgent as the Kannel
> is expected to be in production by today :P. Thank you very much

what does netstat say?

for me:

[EMAIL PROTECTED] sudo netstat -aep |grep 13
Password:
tcp        0      0 *:13000                 *:*                     LISTEN      root   
    2345       1895/bearerbox      
tcp        0      0 *:13001                 *:*                     LISTEN      root   
    2350       1895/bearerbox      
tcp        0      0 *:13333                 *:*                     LISTEN      root   
    2356       1895/bearerbox      

and a process running on socket allowing local access only:

[EMAIL PROTECTED] netstat -alp |grep pin
tcp        0      0 localhost.localdom:3571 *:*                     LISTEN      
6118/pind           
unix  2      [ ]         DGRAM                    85608  6118/pind      

e.g.

[EMAIL PROTECTED] telnet betty 13333
Trying 192.168.1.143...
Connected to betty.
Escape character is '^]'.
Connection closed by foreign host.

(i.e. success)

[EMAIL PROTECTED] telnet betty 3571 
Trying 192.168.1.143...
telnet: connect to address 192.168.1.143: Connection refused
 

James.
#!/bin/sh
#
# gateway         This shell script takes care of starting and stopping
#                 the Kannel SMS gateway (bearer/smsbox) 
#                 originally by Fabrice Gatille <[EMAIL PROTECTED]>
#                 modified by Doolin Technologies
# chkconfig: 2345 97 03
# description:  Start and stop the Kannel SMS gateway
# probe: true
# processname: kannel
# config: /etc/smskannel.conf
# pidfile: /var/run/kannel/kannel.pid

# start-stop-daemon not used
#START="/usr/local/sbin/start-stop-daemon -S --quiet -b -c web:web -x "
CONF=/etc/smskannel.conf

LOCKFILE=/var/lock/subsys/kannelsmsgateway
PIDFILE=/var/run/kannel/kannel.pid
#LOGFILE=/dev/null
LOGFILE=/var/log/kannelbbox.log

SMSLOCKFILE=/var/lock/subsys/kannelsms
SMSPIDFILE=/var/run/kannel/kannelsms.pid
#SMSLOGFILE=/dev/null
SMSLOGFILE=/var/log/kannelsmsbox.log

WAPLOCKFILE=/var/lock/subsys/kannelwap
WAPPIDFILE=/var/run/kannel/kannelwap.pid
#WAPLOGFILE=/dev/null
WAPLOGFILE=/var/log/kannelwapbox.log

BBOX=/usr/local/sbin/bearerbox
WAPBOX=/usr/local/sbin/wapbox
SMSBOX=/usr/local/sbin/smsbox

prog=bearerbox
smsprog=smsbox
wapprog=wapbox

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -x $BBOX ] || exit 0
[ -x $SMSBOX ] || exit 0

[ -f $CONF ] || exit 0

ret=0

checkandtellaction(){
        laction=$1
        lcheck=$2
        lprog=$3
        llock=$4
        llogfile=$5

        if [ $lcheck -eq 0 ]; then
            action $"$laction $lprog: " /bin/true
        else
            action $"$laction $lprog: " /bin/false
            echo "   see $llogfile"
        fi

        return $lcheck
}


startcheckandlock(){
        lcheck=$1
        llock=$3
        checkandtellaction "Starting" $1 $2 $3 $4
        [ $lcheck -eq 0 ] && touch $llock
        return $lcheck
}

stopcheckandunlock(){
        lcheck=$1
        llock=$3
        checkandtellaction "Stopping" $1 $2 $3 $4
        [ $lcheck -eq 0 ] && rm -f $llock
        return $lcheck
}

start(){

        $BBOX $CONF >$LOGFILE 2>&1 &
        startcheckandlock $? $prog $LOCKFILE $LOGFILE

        ret=$?
        if [ $ret -eq 0 ]; then
            $SMSBOX $CONF >$SMSLOGFILE 2>&1 &
            startcheckandlock $? $smsprog $SMSLOCKFILE $SMSLOGFILE
        fi

        return $?
}

stop(){
        #`wget --http-user=tester --http-passwd=bar http://localhost:13000/`

        killproc $SMSBOX
        #/bin/kill `cat $SMSPIDFILE  2> /dev/null ` > /dev/null 2>&1
        stopcheckandunlock $? $smsprog $SMSLOCKFILE $SMSLOGFILE
        # carry on with stop regardless anyway [ $? -ne 0 ] && return $?

        killproc $BBOX
        #/bin/kill `cat $PIDFILE  2> /dev/null ` > /dev/null 2>&1
        stopcheckandunlock $? $prog $LOCKFILE $LOGFILE
        return $?
}

# See how we were called.
case "$1" in
  start)
        start
        ;;

  stop)
        stop
        ;;

  status)
        status bearerbox
        status smsbox
        exit $?
        ;;

  restart)
        $0 stop
        sleep 1
        $0 start
        ;;  

  *)
        echo "Usage: kannel {start|stop|status|restart}"
        exit 1
esac

exit $ret

Reply via email to