Fixed that udp_server process is not terminated with parent pandora_agent
process termination.
(cherry picked from commit 897a38e316
)
This commit is contained in:
parent
832476f1ee
commit
26609c9ff8
|
@ -209,6 +209,9 @@ my %Macros;
|
|||
# PID of tentacle proxy, used in proxy mode
|
||||
my $tentacle_pid = undef;
|
||||
|
||||
# PID of udp_server
|
||||
my $udp_server_pid = undef;
|
||||
|
||||
################################################################################
|
||||
# Print usage information and exit.
|
||||
################################################################################
|
||||
|
@ -1902,6 +1905,13 @@ sub kill_signal_handler (){
|
|||
print "kill -9 $tentacle_pid\n";
|
||||
`kill -9 $tentacle_pid`;
|
||||
}
|
||||
|
||||
# Kill udp_server if it was forked.
|
||||
if (defined ($udp_server_pid) && $udp_server_pid) {
|
||||
kill 'TERM', $udp_server_pid;
|
||||
log_message ('udp server', 'terminated.');
|
||||
}
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
@ -2107,9 +2117,10 @@ $ENV{'PATH'} .= ":$ConfDir/plugins";
|
|||
|
||||
# Start UDP server if configured
|
||||
if ($Conf{'udp_server'} == 1){
|
||||
my $pid = fork();
|
||||
$udp_server_pid = fork();
|
||||
|
||||
if ($pid == 0){
|
||||
if ($udp_server_pid == 0){
|
||||
$0 = 'udp_server (pandora_agent)';
|
||||
udp_server ($Conf{'udp_server_port'}, $Conf{'udp_server_auth_address'});
|
||||
exit;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue