summaryrefslogtreecommitdiff
path: root/check_postgres.pl
diff options
context:
space:
mode:
authorGreg Sabino Mullane2015-12-15 15:18:38 +0000
committerGreg Sabino Mullane2015-12-15 15:18:38 +0000
commit712fa84873869d63fbb37dab1050fadaf20f630f (patch)
treea0bd73f40196fa2c6e81d8f753788a489dc51542 /check_postgres.pl
parent2ad675dcd268c84a0b3f4e6bdbfb695754b4b0cc (diff)
Add new argument, --audit-file-dir, to allow control of which directory the same-schema action will use to store its files.
Diffstat (limited to 'check_postgres.pl')
-rwxr-xr-xcheck_postgres.pl12
1 files changed, 12 insertions, 0 deletions
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.