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" <[email protected]>
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
>
>
>