Bacula-users

Re: [Bacula-users] Mini stupid how-to restore mark all .bak file

2009-01-15 15:19:46
Subject: Re: [Bacula-users] Mini stupid how-to restore mark all .bak file
From: Bruno Friedmann <bruno AT ioda-net DOT ch>
To: Foo <bfoo33 AT yahoo.co DOT uk>
Date: Thu, 15 Jan 2009 21:15:05 +0100
Foo wrote:
> On Tue, 13 Jan 2009 11:58:09 +0100, Bruno Friedmann <bruno AT ioda-net DOT 
> ch>  
> wrote:
> 
>> Sorry this seems stupid but when I enter in a restore
>> I use the choice 3 ( list of jobids )
>>
>> get my / rebuild
>> If I issue a find *.bak it find and list all what I want to mark and  
>> restore (recurse also)
>> but giving  a
>> mark *.bak give  0 file marked
>>
>> help say mark dir/file to be restored recursively, wildcards allowed
> 
> The recursive behaviour is broken, as well as listing already marked files  
> outside of the directory they are in, in every version I used so far (2.0  
> - 2.4.3).
> 
> My workaround for this is:
> 
> - use 'list jobs' or 'list jobname="<jobname>" to find the jobid you need,  
> use '@output /tmp/foo' then 'list files jobid=<nnn>', then '@output' to  
> dump the file list to /tmp/foo
> - on a single line (hopefully not munged by the list/by browsers):
> grep ".bak " /tmp/foo | awk '{ gsub(/^\|\ |\ +\|$/,""); print }' | awk -F  
> "/" '{ printf ("cd \""); for (i=1; i<NF; i++) printf ("%s/", $i); printf  
> ("\"\n"); print "mark \"" $NF "\"" }' >/tmp/foo2
> 
> Note the space behind the extension, this makes sure we only get files  
> that end with this (so .bak.2 and similar will not be restored). The awks  
> strip leading/trailing pipes and spaces, then strip off path (using '/' as  
> separator), does a cd to the path, then marks the file (NF is number of  
> fields on the line, $NF is last field).
> 
> - in bconsole do restore, during file selection do '@input /tmp/foo2' -  
> this will dump the file we just created above resulting in a bunch of cd  
> and mark statements executed by bconsole. Use estimate or count to see how  
> many files you marked, should be the same as 'wc -l /tmp/foo2'.
> 
> With lots of files this is slow, it could be optimized to cd to a dir only  
> once and use wildcards for marking instead of the full filename, but  
> that's left up to the reader :)
> 

Thanks foo for the script (awk is not my favorite friends and have some 
difficulties to talk with it )

Did you think it's possible to run this against a 50000 files results.

But I've just found a way to have an unlimited history in the new kde4 konsole.
which save me ...

Now just have to insert it in the bconsole restore command.


Really I appreciate the script, which would certainly be used one day or 
another.

Thanks.

-- 

     Bruno Friedmann


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users