2008-08-20 23:39:42 +02:00
|
|
|
diff -Nru baras/baras.pl baras-new/baras.pl
|
|
|
|
--- baras/baras.pl 2007-08-13 03:36:01.000000000 +0200
|
2009-02-22 21:43:45 +01:00
|
|
|
+++ baras-new/baras.pl 2009-02-22 21:40:08.000000000 +0100
|
2008-08-20 23:39:42 +02:00
|
|
|
@@ -1,7 +1,7 @@
|
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
BEGIN {
|
|
|
|
- push @INC, "/var/adm/baras/";
|
|
|
|
+ push @INC, "/usr/lib/baras/";
|
|
|
|
}
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
2009-02-22 21:43:45 +01:00
|
|
|
@@ -21,17 +21,19 @@
|
|
|
|
'BARAS_DCF' => 'baras.dcf',
|
|
|
|
'BARAS_ETC' => '/etc/baras/',
|
|
|
|
'BARAS_VERBOSE' => 'no',
|
|
|
|
- 'BASENAME' => $tempdate,
|
|
|
|
+ 'BASENAME' => "$tempdate",
|
|
|
|
'COPY_DAR' => 'yes',
|
|
|
|
'DAR_MGR' => 'no',
|
|
|
|
'DAR_STATIC' => '',
|
|
|
|
'DESTINATION' => '/mnt/backup',
|
|
|
|
'EMAIL' => 'no',
|
|
|
|
- 'HOSTNAME' => $hostname,
|
|
|
|
+ 'HOSTNAME' => "$hostname",
|
|
|
|
'LOG_FILE' => '/var/log/baras.log',
|
|
|
|
+ 'LS_BINARY' => '/bin/ls',
|
|
|
|
'OUTPUT' => '',
|
|
|
|
'REMOVE_FIRST' => 'no',
|
|
|
|
'ROTATION_SCHEDULE' => 'rotation.schedule',
|
|
|
|
+ 'TEMP_LOG' => "/tmp/tmp.$$",
|
|
|
|
'TEST_ARCHIVE' => 'yes'
|
|
|
|
};
|
|
|
|
|
|
|
|
@@ -155,7 +157,7 @@
|
|
|
|
open NOTICE, ">".$config->{'DESTINATION'}."/".$config->{'WORK_DIR'}."/reference_archive.txt" or
|
|
|
|
die "Could not write out reference_archive.txt!\n";
|
|
|
|
print NOTICE "The reference archive for this backup was:\n";
|
|
|
|
- print NOTICE `/bin/ls -ltv $config->{'DESTINATION'}/$reference_archive/*.dar`;
|
|
|
|
+ print NOTICE `$config->{'LS_BINARY'} -ltv $config->{'DESTINATION'}/$reference_archive/*.dar`;
|
|
|
|
close NOTICE;
|
|
|
|
} # nonblank
|
|
|
|
} else {
|
|
|
|
@@ -184,12 +186,14 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
# Wipe out old stuff
|
|
|
|
-wipe_dir($config->{'DESTINATION'}."/$current_archive") if $config->{'REMOVE_FIRST'};
|
|
|
|
+if (lc $config->{'REMOVE_FIRST'} eq 'yes') {
|
|
|
|
+ wipe_dir($config->{'DESTINATION'}."/$current_archive");
|
|
|
|
+}
|
|
|
|
|
|
|
|
# Launch DAR
|
|
|
|
my_print($config, "Creating backup with DAR... ");
|
|
|
|
|
|
|
|
-my $command = $config->{'DAR_COMMAND'}." ".$reference_basename." > /tmp/tmp.$$";
|
|
|
|
+my $command = $config->{'DAR_COMMAND'}." ".$reference_basename." > $config->{'TEMP_LOG'}";
|
|
|
|
$command =~ s|//|/|g; # Remove double //
|
|
|
|
my_print($config, "'$command'\n") if $verbose;
|
|
|
|
my $dar_result = system $command;
|
|
|
|
@@ -197,17 +201,17 @@
|
|
|
|
if ($dar_result != 0) {
|
|
|
|
die "Fatal error: dar failed with error code $dar_result\n";
|
|
|
|
} else {
|
|
|
|
- open LOGF, "</tmp/tmp.$$";
|
|
|
|
+ open LOGF, "< $config->{'TEMP_LOG'}";
|
|
|
|
while (<LOGF>) {
|
|
|
|
my_print($config, $_);
|
|
|
|
};
|
|
|
|
close LOGF;
|
|
|
|
- unlink "/tmp/tmp.$$";
|
|
|
|
+ unlink "$config->{'TEMP_LOG'}";
|
|
|
|
} # DAR results
|
|
|
|
|
|
|
|
if (lc $config->{'TEST_ARCHIVE'} eq 'yes') {
|
|
|
|
my_print($config, "\nTesting the archive for errors...\n");
|
|
|
|
- my $testcmd = $config->{'DAR_BINARY'}." -t ".$config->{'DESTINATION'}."/".$config->{'WORK_DIR'}."/".$config->{'BASENAME'}." --noconf";
|
|
|
|
+ my $testcmd = $config->{'DAR_BINARY'}." -Q -t ".$config->{'DESTINATION'}."/".$config->{'WORK_DIR'}."/".$config->{'BASENAME'}." --noconf";
|
|
|
|
$testcmd =~ s|//|/|g; # Remove double //
|
|
|
|
my_print($config, "$testcmd\n") if $verbose;
|
|
|
|
my $pid = fork;
|
|
|
|
@@ -223,7 +227,9 @@
|
|
|
|
} # TEST_ARCHIVE
|
|
|
|
|
|
|
|
# Wipe out old stuff (unless already done before)
|
|
|
|
-wipe_dir($config->{'DESTINATION'}."/$current_archive") unless $config->{'REMOVE_FIRST'};
|
|
|
|
+if (lc $config->{'REMOVE_FIRST'} ne 'yes') {
|
|
|
|
+ wipe_dir($config->{'DESTINATION'}."/$current_archive");
|
|
|
|
+}
|
|
|
|
|
|
|
|
# Move into the work directory
|
|
|
|
chdir "$config->{'DESTINATION'}/$config->{'WORK_DIR'}" or die "A valid dar backup may be present, but couldn't chdir to test it?!\n";
|
2008-08-20 23:39:42 +02:00
|
|
|
diff -Nru baras/etc/baras/baras.conf baras-new/etc/baras/baras.conf
|
|
|
|
--- baras/etc/baras/baras.conf 2007-08-13 03:37:10.000000000 +0200
|
2009-02-22 21:43:45 +01:00
|
|
|
+++ baras-new/etc/baras/baras.conf 2009-02-22 21:41:00.000000000 +0100
|
2008-08-20 23:39:42 +02:00
|
|
|
@@ -50,8 +50,8 @@
|
|
|
|
REMOVE_FIRST="no"
|
|
|
|
|
|
|
|
# PAR2 usage
|
|
|
|
-PAR_ARCHIVE="two"
|
|
|
|
-PAR2=/usr/bin/par2
|
|
|
|
+#PAR_ARCHIVE="two"
|
|
|
|
+#PAR2=/usr/bin/par2
|
|
|
|
#PAR2_PERCENTAGE=5
|
|
|
|
|
|
|
|
# Pre-processing
|
|
|
|
@@ -88,13 +88,13 @@
|
|
|
|
#BASENAME="$(date +'%m-%d-%Y_%H%M')"
|
|
|
|
|
|
|
|
# The location of the DAR executable file
|
|
|
|
-DAR_BINARY="/usr/local/bin/dar"
|
|
|
|
+DAR_BINARY="/usr/bin/dar"
|
|
|
|
|
|
|
|
# The location of the DAR MANAGER executable file
|
|
|
|
-DAR_MGR_BINARY="/usr/local/bin/dar_manager"
|
|
|
|
+DAR_MGR_BINARY="/usr/bin/dar_manager"
|
|
|
|
|
|
|
|
# The location of the statically-compiled DAR executable file
|
|
|
|
-DAR_STATIC="/usr/local/bin/dar_static"
|
|
|
|
+DAR_STATIC="/usr/bin/dar_static"
|
|
|
|
|
|
|
|
# The temporary directory name that backups will be created in. This will be created underneath $DESTINATION.
|
|
|
|
WORK_DIR=".baras_temp_workdir"
|
2009-02-22 21:43:45 +01:00
|
|
|
@@ -107,5 +107,5 @@
|
|
|
|
DAR_COMMAND="$DAR_BINARY -Q --batch $BARAS_ETC/$BARAS_DCF -c $DAR_CREATE --noconf"
|
|
|
|
|
|
|
|
# Location and name of temporary log file
|
|
|
|
-TEMP_LOG="$BARAS_ETC/baras_temp.log"
|
|
|
|
+TEMP_LOG="/tmp/baras_temp.log"
|
|
|
|
|