Thanks
a lot!
It
works very fine!
/Peter
Lofman
From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Fink
Sent: den 23 oktober 2003 23:11
To: Peter Löfman
Cc: [EMAIL PROTECTED]
Subject: Re: start-stop-daemon
On 23.10.2003, at 19:15, Peter Löfman wrote:
Hi
List,
/x-tad-bigger>/fontfamily>
I’m thinking of starting the boxes
asdeamonsand usingrun_kannel_boxto have them restarting automatically in case
of a crash.
/x-tad-bigger>/fontfamily>
OS isRedHat 9.0.
/x-tad-bigger>/fontfamily>
Can I start/stop it like other
daemons (likesyslogd) with an/etc/init.d/kannel
start|stop|restart|statusscript??
/x-tad-bigger>/fontfamily>Does
anyone have any examples how to do this??
/x-tad-bigger>/fontfamily>I find
these programs a bit undocumented…
/x-tad-bigger>/fontfamily>
here's what we have in /etc/rc.d/init.d/kannel on RedHat 9:
(q3 afink afink)$ cat /etc/rc.d/init.d/kannel
#!/bin/bash
RUN=/var/run/kannel
BIN=/usr/local/sbin
DELAY="1"
CONF="/etc/kannel.conf"
if [ "$1" = "start" ]
then
echo "Starting bearerbox"
su -c "$BIN/run_kannel_box --pidfile $RUN/run_kannel_bearerbox.pid
--min-delay $DELAY $BIN/bearerbox $CONF &" kannel
sleep 1
echo "Starting smsbox"
su -c "$BIN/run_kannel_box --pidfile $RUN/run_kannel_smsbox.pid
--min-delay $DELAY $BIN/smsbox $CONF &" kannel
sleep 1
echo "Starting wapbox"
su -c "$BIN/run_kannel_box --pidfile $RUN/run_kannel_wapbox.pid
--min-delay $DELAY $BIN/wapbox $CONF &" kannel
fi
if [ "$1" = "stop" ]
then
kill `cat $RUN/run_kannel_wapbox.pid`
kill `cat $RUN/run_kannel_smsbox.pid`
kill `cat $RUN/run_kannel_bearerbox.pid`
sleep 1
killall -9 bearerbox
killall -9 run_kannel_box
killall -9 smsbox
fi
if [ "$1" = "restart" ]
then
/etc/rc.d/init.d/kannel stop
sleep 10
/etc/rc.d/init.d/kannel start
fi
Note:
a) you need to create a user "kannel"
b) you need to make directories /var/log/kannel and /var/run/kannel which
belong to user kannel
This script will start the application as user "kannel" and not as root.
Andreas Fink
Global Networks Switzerland AG
------------------------------------------------------------------
Tel: +41-61-6666333 Fax: +41-61-6666334 Mobile:
+41-79-2457333
Global Networks, Inc. Clarastrasse 3, 4058 Basel,
Switzerland
Web: http://www.global-networks.ch/
[EMAIL PROTECTED]
------------------------------------------------------------------
/x-tad-smaller>/fontfamily>