diff options
Diffstat (limited to 'lib/Smokeping.pm')
-rw-r--r-- | lib/Smokeping.pm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm index b15880b..bba2a6b 100644 --- a/lib/Smokeping.pm +++ b/lib/Smokeping.pm @@ -1874,10 +1874,18 @@ sub check_alerts { next unless $addr; if ( $addr =~ /^\|(.+)/) { my $cmd = $1; - if ($edgetrigger) { - system $cmd,$_,$line,$loss,$rtt,$tree->{host}, ($what =~/raise/); - } else { - system $cmd,$_,$line,$loss,$rtt,$tree->{host}; + # fork them in case they + unless ($pid = fork) { + unless (fork) { + $SIG{CHLD} = 'DEFAULT'; + if ($edgetrigger) { + exec $cmd,$_,$line,$loss,$rtt,$tree->{host}, ($what =~/raise/); + } else { + exec $cmd,$_,$line,$loss,$rtt,$tree->{host}; + } + die "exec failed!"; + } + exit 0; } } elsif ( $addr =~ /^snpp:(.+)/ ) { |