[Dirvish] More than on tree per backup?

Kelsey Cummings kgc at corp.sonic.net
Sun Feb 11 08:14:11 PST 2007


On Sun, Feb 11, 2007 at 07:33:23AM +0000, Noel Kelly wrote:
> >I do.  It only took a couple of minutes to hack into place what I think is
> >a more expected way of defining backups.  Hackish, yes, but now I have a
> >paths: option that, if present, overrides $srctree as derived from tree:
> 
> Kelsey - can you post the hack if it is not too involved?  I like the 
> look of the path: parameter:
> 
> >tree: / 
> >paths: / /boot /var

No assurances it will work with all the features of dirvish but it would be
easy to fix the rest.  Not sure why system wouldn't take @cmd directly but
putting it back into a string and letting the shell deal with it was an
easy fix.

# diff -u dirvish dirvish-hack 
--- dirvish     2007-01-31 13:21:34.000000000 -0800
+++ dirvish-hack        2007-02-11 08:09:24.000000000 -0800
@@ -237,6 +237,7 @@
        vault=s
        client=s
        tree=s
+       paths=s
        image=s
        image-time=s
        expire=s
@@ -535,13 +536,28 @@
 
 $ENV{RSYNC_RSH} = $$Options{rsh};
 
- at cmd = (
-       ($$Options{rsync} ? $$Options{rsync} : 'rsync'),
-       @rsyncargs,
-       $rclient . $srctree . '/',
-       $destree
-       );
-printf SUMMARY "\n%s: %s\n", 'ACTION', join (' ', @cmd);
+if ( $$Options{paths} )
+{
+       $srctree = "'$$Options{paths}'";
+       @cmd = (
+               ($$Options{rsync} ? $$Options{rsync} : 'rsync'),
+               @rsyncargs,
+               $rclient . $srctree . " ",
+               $destree
+               );
+       printf SUMMARY "\n%s: %s\n", 'ACTION', join (' ', @cmd);
+
+}
+else
+{
+       @cmd = (
+               ($$Options{rsync} ? $$Options{rsync} : 'rsync'),
+               @rsyncargs,
+               $rclient . $srctree . '/',
+               $destree
+               );
+       printf SUMMARY "\n%s: %s\n", 'ACTION', join (' ', @cmd);
+}
 
 $$Options{'no-run'} and exit 0;
 
@@ -649,7 +665,8 @@
        open (OUTHOLD, ">&STDOUT");
        open (STDOUT, ">$log_temp");
 
-       $status{code} = (system(@cmd) >> 8) & 255;
+       #$status{code} = (system(@cmd) >> 8) & 255;
+       $status{code} = (system(join(" ", at cmd)) >> 8) & 255;
 
        open (STDERR, ">&ERRHOLD");
        open (STDOUT, ">&OUTHOLD");

-- 
Kelsey Cummings - kgc at corp.sonic.net      sonic.net, inc.
System Architect                          2260 Apollo Way
707.522.1000                              Santa Rosa, CA 95407


More information about the Dirvish mailing list