From: Greg Sabino Mullane Date: Thu, 9 Oct 2008 18:33:54 +0000 (-0400) Subject: Call File::Temp::cleanup() explicitly, as CLEANUP => 1 on tempdir() X-Git-Tag: 2.9.0~229 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=26df13ba1a6e3893548454c7b3c2e30837c31770;p=check_postgres.git Call File::Temp::cleanup() explicitly, as CLEANUP => 1 on tempdir() creates an END block that is not always reached on some systems. Per report by sb@nnx.com. --- diff --git a/check_postgres.pl b/check_postgres.pl index f0b5e015b..5e93605b6 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -28,7 +28,7 @@ $Data::Dumper::Varname = 'POSTGRES'; $Data::Dumper::Indent = 2; $Data::Dumper::Useqq = 1; -our $VERSION = '2.3.3'; +our $VERSION = '2.3.4'; use vars qw/ %opt $PSQL $res $COM $SQL $db /; @@ -290,6 +290,7 @@ if ($opt{showtime}) { ## We don't (usually) want to die, but want a graceful Nagios-like exit instead sub ndie { + File::Temp::cleanup(); my $msg = shift; chomp $msg; print "ERROR: $msg\n"; @@ -1028,6 +1029,8 @@ sub run_command { close $errfh or ndie qq{Could not close $errorfile: $!\n}; close $tempfh or ndie qq{Could not close $tempfile: $!\n}; + File::Temp::cleanup(); + $info->{hosts} = keys %host; $VERBOSE >= 3 and warn Dumper $info; @@ -1042,7 +1045,6 @@ sub run_command { return $info; - } ## end of run_command @@ -3549,7 +3551,7 @@ sub check_sequence { =head1 NAME B - a Postgres monitoring script for Nagios, MRTG, and others -This documents describes check_postgres.pl version 2.3.3 +This documents describes check_postgres.pl version 2.3.4 =head1 SYNOPSIS @@ -4690,7 +4692,11 @@ Items not specifically attributed are by Greg Sabino Mullane. =over 4 -=item B +=item B + + Do explicit cleanups of the temp directory, per problems reported by sb@nnx.com. + +=item B Account for cases where some rounding queries give -0 instead of 0. Thanks to Glyn Astill for helping to track this down.