Re: Re: Need help with Debian startup script (restart/stop command)

2015-12-07 Thread Grant Vorenberg
echo "backing up kannel queue"
rm -f /var/spool/queue_kannel.bak
cp /var/spool/kannel /var/spool/queue_kannel.bak
echo "Stopping SQLBox"
/usr/bin/killall -9 sqlbox
echo "Stopping BearerBox"
/usr/bin/killall -9 bearerbox
/bin/sleep 5
echo " "
echo "Starting BearerBox"
/usr/local/sbin/bearerbox -v 5 /usr/local/sbin/smskannel.conf &
/bin/sleep 5
echo "Starting SQLBox"
/usr/local/sbin/sqlbox -v 5 /usr/local/etc/sqlbox.conf &
/bin/sleep 1
echo "All processes started"

--
Office: 0861 SAICOM (724 266)
Direct: 010 140 5012
Support: 010 140 5050
Fax: 010 140 5001
Email: gr...@saicomvoice.co.za
Visit our website: www.saicomvoice.co.za


Re: Re: Need help with Debian startup script (restart/stop command)

2015-12-07 Thread spameden
2015-12-07 15:08 GMT+03:00 Grant Vorenberg :

> 
>
> echo "backing up kannel queue"
> rm -f /var/spool/queue_kannel.bak
> cp /var/spool/kannel /var/spool/queue_kannel.bak
> echo "Stopping SQLBox"
> /usr/bin/killall -9 sqlbox
> echo "Stopping BearerBox"
> /usr/bin/killall -9 bearerbox
> /bin/sleep 5
> echo " "
> echo "Starting BearerBox"
> /usr/local/sbin/bearerbox -v 5 /usr/local/sbin/smskannel.conf &
> /bin/sleep 5
> echo "Starting SQLBox"
> /usr/local/sbin/sqlbox -v 5 /usr/local/etc/sqlbox.conf &
> /bin/sleep 1
> echo "All processes started"
>
Hi!

Look into kannel's mailing lists archives, one was posted there recently.

Or just use:
http://www.kannel.org/download/1.4.4/gateway-1.4.4/debian/kannel.init

Actually you didn't say which Debian version you're using? 6, 7, 8? Because
in recent Debian sysvinit was replaced with systemd.


>
> Grant Vorenberg
>
> Technical Manager
> Office  0861 SAICOM (724 266) Direct  010 140 5012 Support  010 140 5050
> Cell  - Fax  010 140 5001 Email  gr...@saicomvoice.co.za Visit our website
> www.saicomvoice.co.za
>
> [image: logo image] 
>
>


Re: Need help with Debian startup script (restart/stop command)

2015-11-09 Thread Richard Ng
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:   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