[Dirvish] Re: stop dirvish but not loose transfered data

Ime Smits dirvish at imesmits.nl
Wed Nov 30 07:20:07 EST 2005


Hi,

Referring to the message of Joel Franco, nov 11th, I have a similar 
problem. Sometimes, the link used to take backups prooves not to be 
reliable, and dirvish by default seems to rm -rf the whole incremental 
tree if rsync/ssh fails during transfer.

As I would like to keep the already transfered data and continue the 
backup the next night, I'ld suggest an option for a threshold expressed 
either in time spend or bytes transfered before an error occurs.

A quick and dirty patch is included below, in short, if the rsync 
process has run more than 900 seconds, I remove the fatal status flag so 
the backup will be marked as succeeded.

--Ime




*** /sbin/dirvish-dist  2005-10-21 13:16:53.000000000 +0200
--- /sbin/dirvish       2005-11-30 13:06:04.835588368 +0100
***************
*** 534,539 ****
--- 534,541 ----
 
  printf SUMMARY "%s: %s\n", 'Backup-begin', strftime('%Y-%m-%d 
%H:%M:%S', localtime);
 
+ $rsynct0 = time;
+
  $env_srctree = $srctree;              #+SIS:
  $env_srctree =~ s/ /\\ /g;            #+SIS:
 
***************
*** 717,722 ****
--- 719,727 ----
  }
  $WRAPPER_ENV .= ' DIRVISH_STATUS=' .  $Status;
 
+ $rsynct1 = time;
+ $rsynclen = $rsynct1-$rsynct0;
+
  if ($$Options{'post-client'})
  {
        $status{'post-client'} = scriptrun(
***************
*** 760,765 ****
--- 765,780 ----
        }
  }
 
+
+ if($status{fatal}) {
+       if($rsynclen>900) {
+               printf SUMMAY "Backup-error: Fatal error after %d secs, 
but keeping image\n",$resynclen;
+               $Status = $Status_msg = 'success';
+               delete $status{fatal};
+       }
+ }
+
+
  if($status{fatal})
  {
        system ("rm -rf $destree");
***************
*** 773,778 ****
--- 788,795 ----
 
  printf SUMMARY "%s: %s\n",
        'Backup-complete', strftime('%Y-%m-%d %H:%M:%S', localtime);
+ printf SUMMARY "%s: %ds\n",
+       'Rsync-duration',$rsynclen;
 
  printf SUMMARY "%s: %s\n", 'Status', $Status_msg;
 
***************




More information about the Dirvish mailing list