Hi Stephane,
We have been using your great script for a while on Centos. Thanks for
providing a great script to work with.
About a month ago, we moved to the latest CVS and now we can only stop the
wapbox and smsbox with it, but to stop the bearerbox we need to stop it
manually. The actual configurations we use are stored in
"/etc/configurations"
Any advice appreciated.
[gateway]# ps -auxwww|grep kannel
kannel 28660 0.0 0.0 8076 1420 ? Ss 18:49 0:00
/usr/local/sbin/bearerbox --daemonize --parachute --user kannel --pid-file
/var/run/kannel/bearerbox.pid -- /etc/kannel.conf
kannel 28661 0.0 0.1 285432 3456 ? Sl 18:49 0:00
/usr/local/sbin/bearerbox --daemonize --parachute --user kannel --pid-file
/var/run/kannel/bearerbox.pid -- /etc/kannel.conf
kannel 28690 0.0 0.0 9124 1428 ? Ss 18:49 0:00
/usr/local/sbin/smsbox --daemonize --parachute --user kannel --pid-file
/var/run/kannel/smsbox.pid -- /etc/kannel.conf
kannel 28691 0.0 0.1 102080 2764 ? Sl 18:49 0:00
/usr/local/sbin/smsbox --daemonize --parachute --user kannel --pid-file
/var/run/kannel/smsbox.pid -- /etc/kannel.conf
kannel 28704 0.0 0.0 9260 1424 ? Ss 18:49 0:00
/usr/local/sbin/wapbox --daemonize --parachute --user kannel --pid-file
/var/run/kannel/wapbox.pid -- /etc/kannel.conf
kannel 28705 0.0 0.1 163812 2892 ? Sl 18:49 0:00
/usr/local/sbin/wapbox --daemonize --parachute --user kannel --pid-file
/var/run/kannel/wapbox.pid -- /etc/kannel.conf
After running: [gateway]# service kannel stop
Shutting down Mobile Gateway cvs-20070826: [ OK ]
[gateway]# ps -auxwww|grep kannel
kannel 28661 0.0 0.1 121528 3284 ? Sl 18:49 0:00
/usr/local/sbin/bearerbox --daemonize --parachute --user kannel --pid-file
/var/run/kannel/bearerbox.pid -- /etc/kannel.conf
kannel 28690 0.0 0.0 9124 1428 ? Ss 18:49 0:00
/usr/local/sbin/smsbox --daemonize --parachute --user kannel --pid-file
/var/run/kannel/smsbox.pid -- /etc/kannel.conf
kannel 28691 0.0 0.1 102080 2764 ? Sl 18:49 0:00
/usr/local/sbin/smsbox --daemonize --parachute --user kannel --pid-file
/var/run/kannel/smsbox.pid -- /etc/kannel.conf
[gateway]# service kannel status
bearerbox (pid 28661) is running...
smsbox is stopped
wapbox is stopped
[gateway]# kill -9 28661
[gateway]# service kannel status
bearerbox is stopped
smsbox is stopped
wapbox is stopped
----------------------------------------------------------------------------
------------------------------
# This shell script takes care of starting and stopping
# the Kannel SMS & WAP gateway
# Original version Fabrice Gatille <[EMAIL PROTECTED]>
# Modified by Stephane Rosa ([EMAIL PROTECTED]) for RedHat9
# chkconfig: 2345 97 03
# description: Kannel is an SMS and WAP gateway
VERSION=`/usr/local/bin/gw-config --version`
OPTIONS="--daemonize --parachute --user kannel --pid-file /var/run/kannel/"
KANNELPATH=/usr/local/sbin
CONF=/etc/kannel.conf
CONFDIR=/etc/configurations
# 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 ($VERSION): "
daemon /usr/local/sbin/bearerbox ${OPTIONS}bearerbox.pid -- $CONF
RETVAL1=$?
echo
sleep 15
else
exit 0
fi
if [ -n "$startsms" ]; then
echo -n "Starting Mobile Gateway Service 2 ($VERSION): "
daemon /usr/local/sbin/smsbox ${OPTIONS}smsbox.pid -- $CONF
RETVAL2=$?
echo
fi
if [ -n "$startwap" ]; then
echo -n "Starting Mobile Gateway Wap service ($VERSION): "
daemon /usr/local/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.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
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
----------------------------------------------------------------------------
------------------------------