]> oss.titaniummirror.com Git - ovzbpc.git/commitdiff
BackupPC_ovz: control of debug output
authorR. Steve McKown <rsmckown@gmail.com>
Mon, 9 Dec 2013 16:07:49 +0000 (09:07 -0700)
committerR. Steve McKown <rsmckown@gmail.com>
Mon, 9 Dec 2013 16:16:34 +0000 (09:16 -0700)
Write to the debug file only if the debug file is already present at
script start.  This is a simple way to control whether debug output is
generated or not.

BackupPC_ovz

index 014e0827edcb36da2d48df2b8b16f11d4a399c19..2cbc86ca889b79990262893b1e9b41c8d6c37789 100755 (executable)
@@ -24,10 +24,13 @@ my $snapsize = '25g';
 my $hnlistFile = "/etc/backuppc/".basename($0).".hnlist";
 my $velistFile = $ENV{HOME}."/log/".basename($0).".velist";
 
-# Uncomment one of the following
+# Write to the debug file only if it is already present
+my $dbgfn = "/tmp/BackupPC_ovz.debug";
 my $dbgf;
-open $dbgf, ">>/tmp/BackupPC_ovz.debug" || die "Cannot open debug file";
-#open $dbgf, ">>/dev/null" || die "Cannot open debug file";
+if ( ! -f $dbgfn) {
+  $dbgfn = "/dev/null";
+}
+open $dbgf, ">>$dbgfn" || die "Cannot open debug file $dbgfn";
 
 sub mydie($)
 {