On Fri, Jun 11, 2004 at 10:30:45AM +0800, shwong wrote:
> Kannel Host
> -----------
> Cobalt Raq4
>
> Hey james,
>
> Thanks for the script. Will modify it accordingly :)
you're welcome ... actually there was one thing missing.
before start smsbox need either to sleep or do this.
(here's my init.d/kannel with that)
#wait until bbox listening
netstat=""
while [[ ! $netstat ]]; do
echo "not yet";
sleep 1
netstat=`sudo netstat -anp |grep bearerbox`;
done
$SMSBOX $CONF >$SMSLOGFILE 2>&1 &
startcheckandlock $? $smsprog $SMSLOCKFILE $SMSLOGFILE
>
>
> > 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 ?
>
> Nope, the port 13131 (send-sms port) is not telnetable remotely. But
> through the localhost,the same port is accessible.
>
>
>
> > [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:
doh! (me)
where is my smsbox??
if smsbox manages to start okay!! : (check using service script sudo /sbin/service
kannel status )
sudo netstat -anp |grep smsbox
tcp 0 0 0.0.0.0:13013 0.0.0.0:* LISTEN
29795/smsbox
tcp 0 0 127.0.0.1:43836 127.0.0.1:13001 ESTABLISHED
29795/smsbox
0.0.0.0 okay.
and then telnet from external host does work
[EMAIL PROTECTED] telnet betty 13013
Trying 192.168.1.143...
Connected to betty.
Escape character is '^]'.
from my kannel .conf ... and reading manual quickly I don't actually see how
smsbox socket can be restricted to localhost:
group = smsbox
bearerbox-host = localhost
sendsms-port = 13013
global-sender = 353861111111
log-file = "/var/log/smsc-smsbox.log"
#log-level = 0
access-log = "/var/log/smsc-smsbox-access.log"
> > [EMAIL PROTECTED] netstat -alp |grep pin
> > tcp 0 0 localhost.localdom:3571 *:* LISTEN
> > 6118/pind
> > unix 2 [ ] DGRAM 85608 6118/pind
> >
> "netstat -alp | grep pin" returned nothing .
! oops ... that is not related to kannel or smsbox
but actually it is an example of a socket listening only for local connections
okay anyway with bearerbox and smsbox running happily and talking to each other:
[EMAIL PROTECTED] $ sudo netstat -aep |grep 13
Password:
tcp 0 0 *:13000 *:* LISTEN root
156063 30486/bearerbox
tcp 0 0 *:13001 *:* LISTEN root
156070 30486/bearerbox
tcp 0 0 *:13013 *:* LISTEN root
156923 30506/smsbox
tcp 0 0 *:13333 *:* LISTEN root
156075 30486/bearerbox
tcp 0 0 localhost.localdo:43889 localhost.localdo:13001 ESTABLISHED root
156933 30506/smsbox
tcp 0 0 localhost.localdo:13001 localhost.localdo:43889 ESTABLISHED root
156936 30486/bearerbox
tcp 0 0 betty.dev.ie.alph:13001 boole.dub.ie.alph:39222 ESTABLISHED root
159411 30486/bearerbox
(and ports 13000 13001 13013 13333 accessible from external boxes fine)
SO anyway .... your bearerbox port does look fine but actually ... where is your
smsbox?
And what was the original question? No don't answer. I half remember.
I need wither more sleep or coffee or something I think!!
James.
> Thank you so much for your time.
Very welcome you are siew hui.
--
http://web.tiscali.it/cedric/
Jacques Brel Show - june - ireland, italy, south africa
#!/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
#wait until bbox listening
netstat=""
while [[ ! $netstat ]]; do
echo "not yet";
sleep 1
netstat=`sudo netstat -anp |grep bearerbox`;
done
$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