Update of /cvsroot/rsnapshot/rsnapshot
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv27470
Modified Files:
AUTHORS rsnapshot-program.pl rsnapshot.conf.default.in
Log Message:
Added the ability to re-try the rsync operation more than once if it fails. I experience "Corrupted MAC on input" errors sometimes while rsynching with another machine on my network and retrying seems to work (not always though, as I found out). Hopefully this might help someone else as well. Set the 'rsync_numtries' option in rsnapshot.conf file to something >0 to enable this.
Index: rsnapshot.conf.default.in
===================================================================
RCS file: /cvsroot/rsnapshot/rsnapshot/rsnapshot.conf.default.in,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** rsnapshot.conf.default.in 15 Nov 2006 11:24:49 -0000 1.41
--- rsnapshot.conf.default.in 1 Jan 2008 02:24:30 -0000 1.42
***************
*** 182,185 ****
--- 182,192 ----
#use_lazy_deletes 0
+ # Number of rsync re-tries. If you experience any network problems or
+ # network card issues that tend to cause ssh to crap-out with
+ # "Corrupted MAC on input" errors, for example, set this to a non-zero
+ # value to have the rsync operation re-tried
+ #
+ #rsync_numtries 0
+
###############################
### BACKUP POINTS / SCRIPTS ###
Index: rsnapshot-program.pl
===================================================================
RCS file: /cvsroot/rsnapshot/rsnapshot/rsnapshot-program.pl,v
retrieving revision 1.374
retrieving revision 1.375
diff -C2 -d -r1.374 -r1.375
*** rsnapshot-program.pl 20 Sep 2007 11:07:06 -0000 1.374
--- rsnapshot-program.pl 1 Jan 2008 02:24:30 -0000 1.375
***************
*** 162,165 ****
--- 162,168 ----
my $use_lazy_deletes = 0; # do not delete the oldest archive until after backup
+ # set default for number of tries
+ my $rsync_numtries = 1; # by default, try once
+
# exactly how the program was called, with all arguments
# this is set before getopts() modifies < at > ARGV
***************
*** 1405,1408 ****
--- 1408,1428 ----
next;
}
+ # RSYNC NUMBER OF TRIES
+ if ($var eq 'rsync_numtries') {
+ if (!defined($value)) {
+ config_err($file_line_num, "$line - rsync_numtries can not be blank");
+ next;
+ }
+ if (!is_valid_rsync_numtries($value)) {
+ config_err(
+ $file_line_num, "$line - \"$value\" is not a legal value for rsync_numtries, must be greater than or equal to 0"
+ );
+ next;
+ }
+
+ $rsync_numtries = int($value);
+ $line_syntax_ok = 1;
+ next;
+ }
# make sure we understood this line
***************
*** 2565,2568 ****
--- 2585,2601 ----
}
+ # accepts a positive number formatted as string
+ # returns 1 if it's valid, 0 otherwise
+ sub is_valid_rsync_numtries {
+ my $value = shift( < at > _);
+ if (!defined($value)) { return (0); }
+
+ if ($value =~ m/^\d+$/) {
+ if (($value >= 0)) {
+ return (1);
+ }
+ }
+ }
+
# accepts one argument
# checks to see if that argument is set to 1 or 0
***************
*** 3604,3611 ****
print_cmd( < at > cmd_stack);
if (0 == $test) {
! # join is Michael Ashley's fix for some filter/space problems
! $result = system(join(' ', < at > cmd_stack));
!
# now we see if rsync ran successfully, and what to do about it
if ($result != 0) {
--- 3637,3650 ----
print_cmd( < at > cmd_stack);
+
+ my $tryCount = 0;
+ $result = 1;
if (0 == $test) {
! while ($tryCount < $rsync_numtries && $result !=0) {
! # join is Michael Ashley's fix for some filter/space problems
! $result = system(join(' ', < at > cmd_stack));
! $tryCount += 1;
! }
!
# now we see if rsync ran successfully, and what to do about it
if ($result != 0) {
Index: AUTHORS
===================================================================
RCS file: /cvsroot/rsnapshot/rsnapshot/AUTHORS,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** AUTHORS 17 Aug 2007 14:15:36 -0000 1.30
--- AUTHORS 1 Jan 2008 02:24:30 -0000 1.31
***************
*** 81,82 ****
--- 81,85 ----
Ben Low <ben < at > bdlow.net>
- Added support for Linux LVM snapshots
+
+ David Grant <davidgrant < at > gmail.com>
+ - Added support for retrying rsync "rsync_numtries" number of times
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
rsnapshot-discuss mailing list
rsnapshot-discuss < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss
