From 23d759720b40018bcfa4c5036b5a5fb2c9496e77 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Mon, 9 Dec 2013 09:07:49 -0700 Subject: [PATCH] BackupPC_ovz: control of debug output 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BackupPC_ovz b/BackupPC_ovz index 014e082..2cbc86c 100755 --- a/BackupPC_ovz +++ b/BackupPC_ovz @@ -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($) { -- 2.39.2