From 712fa84873869d63fbb37dab1050fadaf20f630f Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Tue, 15 Dec 2015 10:18:38 -0500 Subject: [PATCH] Add new argument, --audit-file-dir, to allow control of which directory the same-schema action will use to store its files. --- check_postgres.pl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/check_postgres.pl b/check_postgres.pl index 9dccaf021..8f63b85ef 100755 --- a/check_postgres.pl +++ b/check_postgres.pl @@ -22,6 +22,7 @@ use utf8; use Getopt::Long qw/GetOptions/; Getopt::Long::Configure(qw/ no_ignore_case pass_through /); use File::Basename qw/basename/; +use File::Spec; use File::Temp qw/tempfile tempdir/; File::Temp->safe_level( File::Temp::MEDIUM ); use Cwd; @@ -1228,6 +1229,7 @@ GetOptions( 'PSQL=s', 'tempdir=s', + 'audit-file-dir=s', 'get_method=s', 'language=s', 'mrtg=s', ## used by MRTG checks only @@ -6998,6 +7000,13 @@ sub audit_filename { $filename .= ".$opt{suffix}"; } + ## Need to store in a separate directory? + my $adir = $opt{'audit-file-dir'}; + if (defined $adir) { + -d $adir or die qq{Cannot write to directory "$adir": $!\n}; + $filename = File::Spec->catfile($adir, $filename); + } + return $filename; } ## end of audit_filename @@ -9666,6 +9675,9 @@ becomes "database #2" and is compared to the current database. To replace the old stored file with the new version, use the --replace argument. +If you need to write the stored file to a specific direectory, use +the --audit-file-dir argument. + To enable snapshots at various points in time, you can use the "--suffix" argument to make the filenames unique to each run. See the examples below. -- 2.39.5