summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Oetiker <tobi@oetiker.ch>2012-04-02 09:20:07 +0200
committerTobias Oetiker <tobi@oetiker.ch>2012-04-02 09:20:07 +0200
commit8837a8d3a033a124644d6085555d70afa1372a30 (patch)
tree21951b3b62948fa07d3fca2634534a6ca6fa9c69
parent79b6c9346c950d0b3e22dc9ba337bbcdcbed052e (diff)
downloadsmokeping-8837a8d3a033a124644d6085555d70afa1372a30.tar.gz
smokeping-8837a8d3a033a124644d6085555d70afa1372a30.tar.xz
wait for the first gen child to terminate
-rw-r--r--lib/Smokeping.pm14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm
index f5743c0..ec05528 100644
--- a/lib/Smokeping.pm
+++ b/lib/Smokeping.pm
@@ -1866,13 +1866,14 @@ sub check_alerts {
my $rtt = "rtt: ".join ", ",map {defined $_ ? (/^\d/ ? sprintf "%.0fms", $_*1000 :$_):"U" } @{$x->{rtt}};
my $time = time;
my @stamp = localtime($time);
- my $stamp = localtime($time);
- my @to;
- foreach my $addr (map {$_ ? (split /\s*,\s*/,$_) : ()} $cfg->{Alerts}{to},$tree->{alertee},$alert->{to}){
- next unless $addr;
- if ( $addr =~ /^\|(.+)/) {
+ my $stamp = localtime($time);
+ my @to;
+ foreach my $addr (map {$_ ? (split /\s*,\s*/,$_) : ()} $cfg->{Alerts}{to},$tree->{alertee},$alert->{to}){
+ next unless $addr;
+ if ( $addr =~ /^\|(.+)/) {
my $cmd = $1;
- # fork them in case they
+ # fork them in case they take a long time
+ my $pid;
unless ($pid = fork) {
unless (fork) {
$SIG{CHLD} = 'DEFAULT';
@@ -1885,6 +1886,7 @@ sub check_alerts {
}
exit 0;
}
+ waitpid($pid, 0);
}
elsif ( $addr =~ /^snpp:(.+)/ ) {
sendsnpp $1, <<SNPPALERT;