Hi, list, I think we're missing this information (about --parachute, --pid-file, --parachute and --panic-script) in the user guide, don't we?
Below is the possible init.d script which we could add to contrib: #!/bin/sh MBUNI=/home/menulis/mbuni BINDIR=$MBUNI/bin PIDFILES=$MBUNI/run CONF=$MBUNI/etc/mmsc.conf MP=mmsproxy MR=mmsrelay test -x $BINDIR/$MP && test -x $BINDIR/$MR || exit 0 case "$1" in start) echo -n "Starting MMSC: mmsproxy" $BINDIR/$MP --daemonize --parachute --pid-file $PIDFILES/$MP.pid -- $CONF sleep 1 echo -n " mmsrelay" $BINDIR/$MR --daemonize --parachute --pid-file $PIDFILES/$MR.pid -- $CONF echo "." ;; stop) echo -n "Stopping MMSC: mmsrelay" kill `cat $PIDFILES/$MR.pid` sleep 1 echo -n " mmsproxy" kill `cat $PIDFILES/$MP.pid` 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|reload|restart|force-reload}" exit 1 esac exit 0 ---------- Forwarded message ---------- From: Alexander Malysh <[EMAIL PROTECTED]> Date: Mar 18, 2006 1:07 PM Subject: Re: Prevent losing SMSs via smsbox - make a program monitor To: users@kannel.org Hi, why always go a complicated way?? Did you read userguide?? Just use something like this: bearerbox --daemonize --parachute smsbox --daemonize --parachute This will start bearerbox and smsboxc as daemon and also start parachute process (watcher). If box then crashed parachute process will restart child process automatically. Thanks, Alex fred schrieb: > heres some extracts of perl code that should help with ideas....(extracts > because the full code is > particular to our conf files and environment etc which is off-topic and i'm > not going to go into it here) > I'm sure you should be able to embelish it with code > to suit your environment....... > > ....... > my $pid = startProcess($execList->{$key}); > if ($DEBUG) { printf STDOUT "startProcess($key)\n"; } > > syslog(LOG_INFO, "starting process %s", $key); > > $pids{$pid} = $key; > > ........... > > # do an eternal loop wait(2)ing for child processes to exit, and restart > them. > # > for (;;) > { > > my $pid = wait; > > sleep 1; > > if ($DEBUG) { printf STDOUT "Child process has died - PID=$pid > KEY=$pids{$pid}\n" }; > syslog(LOG_INFO, "Child process has died - PID=$pid KEY=$pids{$pid} - > restarting"); > > # a pid of < 0 means no children exist. > # > if ($pid > 0) > { > > if (defined $pids{$pid}) > { > > my $key = $pids{$pid}; > undef $pids{$pid}; > > if ($DEBUG) { print "Process $pid died $?\n"; } > > # parse the config again (in case something changed - like a version > number or path to binary or such) > # > require "$CONFDIR/umq.conf"; > > $pid = startProcess($execList->{$key}); > $pids{$pid} = $key; > > if ($DEBUG) { printf STDOUT "Started process %d\n", $pid; } > } > else > { > # who's child is this again? Not ours... > # > if ($DEBUG) { printf STDOUT "nasty %ld\n", $?; } > } > } > else { > # this is a serious situation - no children exist - it's likely that the > system is thrashing > # we'll try 20 loops first before giving up totally... > # > if ($no_kids_found++ > 1) > { > exit(2); > } > } > } > > > > # Start a process given the details in the hash reference. > # > sub startProcess > { > > my ($details) = @_; > my $pid = 0; > if (($details->{RUN} eq 'true') || ($IGNORERUNVAL)) > { > if (($pid = fork()) == 0) > { > > if ($DEBUG) { printf STDOUT "cmd> %s\n", $details->{COMMAND}; } > > # the second exec thing here is for bash - we don't want an unnecessary > shall hanging around > # > exec "exec " . $details->{COMMAND}; // this this argument is like > ".../bearerbox ../conf/kannel-voda.conf >> > /var/log/kannel/bearerbox-voda.log2>&1" > } > } > else > { > printf STDERR "RUN values for $BINDGROUP are not all set to 'true' and -i > option not chosen. Exiting.\n"; > exit(2); > } > return $pid; > } > > > > we use this for both the bearerbox and smsbox process. > Any way this should be enough to get you started on your own u beaut program > monitor. > I'm assuming perl knowledge here, so good luck! > > > ----- Original Message ----- > From: "Hillel" <[EMAIL PROTECTED]> > To: "Kannel Users" <users@kannel.org> > Sent: Friday, March 17, 2006 11:37 PM > Subject: Prevent losing SMSs via smsbox > > >> Hi, >> >> Kannel has a flaw in that if the bearerbox is up but the smsbox is down, >> SMSs will be lost. >> They will not be retried as only the smsbox handles the retries. >> >> Does anyone have a script they can send to the user list that they are >> prepared to share, to ensure the smsbox is up. >> >> This does not happen often that it is down and the bearerbox is up, but > when >> it does, all the SMSs are lost until you realise it is down. >> >> Thanks >> >> >> > > > -- Dziugas _______________________________________________ Devel mailing list Devel@mbuni.org http://mbuni.org/mailman/listinfo/devel_mbuni.org