Dear Alexandr,
You better keep every correspondence on the list.
It can help more than one.
No problem.
I had myself picked up pieces around and somehow modified them to suit my needs.
Below they are.
If you need more let us know.
Regards,
/dvl/scripts/kannel_crash.sh:
#!/bin/sh
DATETIME=`date "+%Y%m%d%H%M%S"`
# Log the start
/bin/echo "bearerbox crashed" >> /dvl/log/kannel/kannel_crash_$DATETIME.log
/bin/date >> /dvl/log/kannel/kannel_crash_$DATETIME.log
# Restart the service
/bin/sleep 20
/sbin/service kannel restart
# Log the end
/bin/echo "it should have resumed" >> /dvl/log/kannel/kannel_crash_$DATETIME.log
/bin/date >> /dvl/log/kannel/kannel_crash_$DATETIME.log
/etc/init.d/kannel:
#!/bin/bash
#----------------------------
# This shell script takes care of starting and stopping
# the Kannel SMS & WAP gateway
# Original version Fabrice Gatille <fgatille at ivision.fr>
# Modified by Stephane Rosa (srosa at domusmea.org) for RedHat9
# chkconfig: 2345 97 03
# description: Kannel is an SMS and WAP gateway
VERSION=`/usr/local/kannel/bin/gw-config --version`
#OPTIONS="--daemonize --parachute --user kannel --pid-file /var/run/kannel/"
OPTIONS="--daemonize --parachute --pid-file /var/run/kannel/"
KANNELPATH=/usr/local/kannel/sbin
CONF=/etc/kannel/kannel.conf
#CONFDIR=/etc/kannel/conf
# Source function library & networking conf.
. /etc/init.d/functions
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
# Check that we are root ... so non-root users stop here
[ `id -u` = 0 ] || exit 1
# Various other checks
[ ${NETWORKING} = "yes" ] || exit 0
[ -x $KANNELPATH/bearerbox ] || exit 0
[ -x $KANNELPATH/smsbox ] || exit 0
[ -x $KANNELPATH/wapbox ] || exit 0
[ -f $CONF ] || exit 0
RETVAL=0; RETVAL1=0; RETVAL2=0; RETVAL3=0
prog="Kannel"
start() {
# Check that at least one group is defined for sms
# and/or wap to start the bearer. Then start boxes
# as needed.
startsms=`egrep -se '^[ \t]*group *= *smsbox' $CONF`
startwap=`egrep -se '^[ \t]*group *= *wapbox' $CONF`
# startsms=`egrep -hse '^[ \t]*group *= *smsbox' $CONF ${CONFDIR}/*`
# startwap=`egrep -hse '^[ \t]*group *= *wapbox' $CONF ${CONFDIR}/*`
if [ -n "$startsms$startwap" ]; then
echo -n "Starting Mobile Gateway Service 1[Bearer box] ($VERSION): "
daemon /usr/local/kannel/sbin/bearerbox --panic-script
/dvl/scripts/kannel_crash.sh ${OPTIONS}bearerbox.pid -- $CONF
RETVAL1=$?
echo
sleep 15
else
exit 0
fi
if [ -n "$startsms" ]; then
echo -n "Starting Mobile Gateway Service 2[SMS Box] ($VERSION): "
daemon /usr/local/kannel/sbin/smsbox ${OPTIONS}smsbox.pid -- $CONF
RETVAL2=$?
echo
fi
if [ -n "$startwap" ]; then
echo -n "Starting Mobile Gateway Wap service[Wap Box] ($VERSION): "
daemon /usr/local/kannel/sbin/wapbox ${OPTIONS}wapbox.pid -- $CONF
RETVAL3=$?
echo
fi
let RETVAL=$REVAL1+$RETVAL2+$RETVAL3
if [ $RETVAL -eq 0 ]; then
sleep 2
touch /var/lock/subsys/gateway
cat /var/run/kannel/*.pid > /var/run/kannel/kannel.pid
fi
return $RETVAL
}
stop() {
echo -n "Shutting down Mobile Gateway $VERSION: "
killproc kannel
RETVAL=$?
echo
if [ $RETVAL -eq 0 ]; then
sleep 2
rm -f /var/lock/subsys/gateway
#rm /var/run/kannel/*.pid
rm /var/run/kannel/*.pid
fi
return $RETVAL
}
# See how we were called.
case "$1" in
start)
# Start daemons.
start
;;
stop)
# Stop daemons
stop
;;
restart)
# Restart daemons
stop
sleep 1
start
;;
status)
status bearerbox
status smsbox
status wapbox
exit $?
;;
*)
echo "Usage: named {start|stop|status|restart}"
RETVAL=1
esac
exit $RETVAL
TSHIMANGA Minkoka
VAS Manager
Mob: +243 814443113
Tel: +243 815560341 ext. 0583
Fax: +243 813010373
Email: [email protected]
Web: http://www.vodacom.cd
-----Original Message-----
From: Alexandr Gubanov [mailto:[email protected]]
Sent: Tuesday 17 May 2011 12:58
To: Tshimanga Minkoka
Subject: Please help me with kannel conf...
Hi, Tshimanga!
I have read your correspondence on the channel [email protected] about
restart bearerbox with parachute.
I had the same problem with my kannel 1.4.2 installed on centos 5.5
Could you send me your script /dvl/scripts/kannel_crash.sh?
And could you tell how to make it work kannel as service? Because when
I run the supplied script (/etc/init.d/kannel) process does not start
and the "ps -ef | grep kannel" did not show and any system logs no
bearerbox and smsbox errors...
Thanks in advance for any help!
----------------------------------------------------------
Best regards,
Alexandr Gubanov,
head of system administration department JSC APPM
w. +78185263134,
fax.+78185263096.
e-mail: [email protected]
web: www.appm.ru