Hello,

 

My startup script seems to work on boot, but I have problems when trying to
run "service kannel restart" or "service kannel stop".

 

I'm running kannel v 1.4.3 on Debian Wheezy 7.8

 

The problem is that none of the boxes shut down nor do they show any logs in
regard to shutdown at all.  Even though my script produces this:

 

root@kanneluser: /var/log/kannel# service kannel stop

Stopping WAP gateway: smsbox sqlbox bearerbox.

 

Obviously when I run kannel service restart, I see errors regarding ports
already in use.etc.   so the startup portion seems to be working fine.

 

Any ideas?

 

Richard Ng

Solistech, LLC

 

e:  <mailto:r...@solistech.com> r...@solistech.com

t: 519.937.1702

f: 888.220.0549

 

#!/bin/sh
# Start/stop the Kannel boxes: One bearer box and one WAP box.

# This is the default init.d script for Kannel.  Its configuration is
# appropriate for a small site running Kannel on one machine.

# Make sure that the Kannel binaries can be found in $BOXPATH or somewhere
# else along $PATH.  run_kannel_box has to be in $BOXPATH.

### BEGIN INIT INFO
# Provides:          kannel
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Should-Start:      $local_fs $network
# Should-Stop:       $local_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: SMS and WAP gateway
# Description:       Kannel is a gateway for connecting WAP phones to the
#                    Internet. It also works as an SMS gateway.
### END INIT INFO

BOXPATH=/usr/sbin
PIDFILES=/var/run/kannel
CONF=/etc/kannel/kannel.conf
SQLBOX_CONF=/etc/kannel/sqlbox.conf

PATH=$BOXPATH:$PATH

# On Debian, the most likely reason for the bearerbox not being available
# is that the package is in the "removed" or "unconfigured" state, and the
# init.d script is still around because it's a conffile.  This is normal,
# so don't generate any output.
test -x $BOXPATH/bearerbox || exit 0

test -r /etc/default/kannel && . /etc/default/kannel

if [ ! -d $PIDFILES ]
then
        mkdir $PIDFILES
        chown kannel:root $PIDFILES
fi

# Check for old pid files before starting.
for PIDFILE in `ls $PIDFILES/kannel_*.pid 2>/dev/null`; do
        if [ -e "$PIDFILE" ] ; then
                kill -0 $(< $PIDFILE) 2> /dev/null || rm -f $PIDFILE 2>/dev/null
        fi
done

#exit;


case "$1" in
  start)
    echo -n "Starting WAP gateway:"
    echo -n " bearerbox"
    start-stop-daemon --start --quiet \
        --pidfile $PIDFILES/kannel_bearerbox.pid \
        --chuid kannel \
        --exec $BOXPATH/bearerbox -- --pid-file $PIDFILES/kannel_bearerbox.pid 
--parachute --daemonize -v 0 $CONF
    sleep 3 # Wait for sqlbox
    test ! -z $START_SQLBOX && test -x $BOXPATH/sqlbox && (
    echo -n " sqlbox"
        start-stop-daemon --start --quiet \
            --pidfile $PIDFILES/kannel_sqlbox.pid \
            --chuid kannel \
            --exec $BOXPATH/sqlbox -- --pid-file $PIDFILES/kannel_sqlbox.pid 
--parachute --daemonize -v 0 $SQLBOX_CONF
    )
    sleep 4 # Wait for smsbox
    test ! -z $START_SMSBOX && (
    echo -n " smsbox"
        start-stop-daemon --start --quiet \
            --pidfile $PIDFILES/kannel_smsbox.pid \
            --chuid kannel \
            --exec $BOXPATH/smsbox -- --pid-file $PIDFILES/kannel_smsbox.pid 
--parachute --daemonize -v 0 $CONF
    )
    echo "."
    ;;

  stop)
    echo -n "Stopping WAP gateway:"
    test ! -z $START_SMSBOX && (
        echo -n " smsbox"
        start-stop-daemon --stop --retry 5 --quiet \
            --pidfile $PIDFILES/kannel_smsbox.pid \
            --name smsbox
    )
    sleep 3 # Wait for smsbox
    test ! -z $START_SQLBOX && test -x $BOXPATH/sqlbox && (
        echo -n " sqlbox"
        start-stop-daemon --stop --retry 5 --quiet \
            --pidfile $PIDFILES/kannel_sqlbox.pid \
            --name sqlbox
    )
    sleep 4 # Wait for sqlbox
    echo -n " bearerbox"
    start-stop-daemon --stop --retry 5 \
        --pidfile $PIDFILES/kannel_bearerbox.pid --quiet \
        --name bearerbox
    echo "."
    ;;

  reload)
    # We don't have support for this yet.
    exit 1
    ;;

  restart|force-reload)
    $0 stop
    sleep 1
    $0 start
    ;;

  *)
    echo "Usage: $0 {start|stop|restart|force-reload}"
    exit 1

esac

exit 0

Reply via email to