Merge branch 'ent-1775-SNMPServer.pm-CDE' into 'develop'
added exception handler See merge request artica/pandorafms!3119
This commit is contained in:
commit
48fc714ba3
|
@ -28,6 +28,8 @@ use Time::Local;
|
|||
use Time::HiRes qw(usleep);
|
||||
use XML::Simple;
|
||||
|
||||
use Scalar::Util qw(looks_like_number);
|
||||
|
||||
# Default lib dir for RPM and DEB packages
|
||||
use lib '/usr/lib/perl5';
|
||||
|
||||
|
@ -540,10 +542,17 @@ sub reset_if_truncated($$) {
|
|||
###############################################################################
|
||||
sub DESTROY {
|
||||
my $self = shift;
|
||||
|
||||
|
||||
if ($self->{'snmp_trapd'} ne 'manual') {
|
||||
system ("kill -9 `cat /var/run/pandora_snmptrapd.pid 2>$DEVNULL`");
|
||||
unlink ('/var/run/pandora_snmptrapd.pid');
|
||||
my $pid_file = '/var/run/pandora_snmptrapd.pid';
|
||||
if (-e $pid_file) {
|
||||
my $pid = `cat $pid_file 2>$DEVNULL`;
|
||||
if (defined($pid) && ("$pid" ne "") && looks_like_number($pid)) {
|
||||
system ("kill -9 $pid");
|
||||
}
|
||||
|
||||
unlink ($pid_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue