RE: start-stop-daemon

Peter Löfman <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
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,

I’m thinking of starting the boxes asdeamonsand usingrun_kannel_boxto have
them restarting automatically in case of a crash.

OS isRedHat 9.0.

Can I start/stop it like other daemons (likesyslogd) with
an/etc/init.d/kannel start|stop|restart|statusscript??
Does anyone have any examples how to do this??
I find these programs a bit undocumented…

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]
------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.