Don't run post-backup command if none
authorJamie Cameron <jcameron@webmin.com>
Tue, 20 Jul 2010 13:29:07 +0000 (06:29 -0700)
committerJamie Cameron <jcameron@webmin.com>
Tue, 20 Jul 2010 13:29:07 +0000 (06:29 -0700)
backup-config/backup.pl

index a486948..efeb47f 100755 (executable)
@@ -10,7 +10,7 @@ $backup = &get_backup($ARGV[0]);
 $backup || die "Failed to find backup $ARGV[0]";
 
 # Run the pre-backup command, if any
-if ($backup->{'pre'}) {
+if ($backup->{'pre'} =~ /\S/) {
        $preout = &backquote_command("($backup->{'pre'}) 2>&1 </dev/null");
        $premsg = &text('email_pre', $backup->{'pre'})."\n".
                  $preout."\n";
@@ -28,7 +28,7 @@ if (!$err) {
        }
 
 # Run the post-backup command, if any
-if (!$err) {
+if (!$err && $backup->{'post'} =~ /\S/) {
        $postout = &backquote_command("($backup->{'post'}) 2>&1 </dev/null");
        $postmsg = "\n".
                  &text('email_post', $backup->{'post'})."\n".