Re: Using find with fbackup

 
SOLVED
Go to solution
Vince Ungaro
Occasional Advisor

Using find with fbackup

Hi,

I wanted to know if it's possible to pipe or redirect the list of files to be backed up to fbackup. I want to do something similiar to how find is used in conjunction with tar. For example:

find / -print | fbackup ....
8 REPLIES 8
James R. Ferguson
Acclaimed Contributor
Solution

Re: Using find with fbackup

Hi Vince:

No, what you suggest won't work quite that way. However, 'fbackup' can use a "graph" file in which directories and/or files can be listed for inclusion and/or exclusion. Hence, your 'fnid' output could produce a graph file that looks like:

i /etc/hosts
i /etc/group
i /etc/passwd

Regards!

...JRF...
Vince Ungaro
Occasional Advisor

Re: Using find with fbackup

Hi James,

Ah ok, I get it.

Since I am trying to automate this, do you know of a simple way to get the "i"'s inserted to my find output? Thanks for the quick reply!

-Vince
James R. Ferguson
Acclaimed Contributor

Re: Using find with fbackup

Hi (again) Vince:

Given a file like:

/etc/group
/etc/hosts
/etc/passwd

You can add the leading "i " with:

# sed -e 's/^/i /p' file > file.out

...or update your file in-place:

# perl -pi -e 's/^/i /' file

Regards!

...JRF...
Jeff_Traigle
Honored Contributor

Re: Using find with fbackup

Something like this should work (although there undoubtedly many ways to accomplish the task):

while read FILENAME
do
echo "i ${FILENAME}" >> mygraphfile
done < $(find / -print)
--
Jeff Traigle
Vince Ungaro
Occasional Advisor

Re: Using find with fbackup

Both solutions worked like a charm. Thanks!

Now this might be off topic but I am still having issues automating this. Please bear with me. I have a temp file that contains the find command to generate the list of files to back up. I use this temp file to execute the find. Then I run your suggested sed command to create a new file for fbackup list but it's not working as expected. Code is below:

FILES=`cat $TempFile1` # Temp file with find command
$FILES > /tmp/files # execute find command and generate file list for fbackup
sed -e 's/^/i /p' /tmp/files > file.list # insert the "i"'s
fbackup -0v -g /tmp/file.list -f - | some other command # run backup

Is my logic or syntax flawed? The error I get is:

fbackup(1412): unable to open graph file /tmp/file.list
fbackup(1404): no files have been specified; (use at least one -i and/or -g option)
James R. Ferguson
Acclaimed Contributor

Re: Using find with fbackup

Hi (again) Vince:

I think that you do not have the graph file where you believe you do, hence the error:

fbackup(1412): unable to open graph file /tmp/file.list

Your post shows redirection without an absolute path:

# sed -e 's/^/i /p' /tmp/files > file.list

..but then:

# fbackup -0v -g /tmp/file.list -f -

...so where is "file.list" really?

Regards!

...JRF...





Vince Ungaro
Occasional Advisor

Re: Using find with fbackup

Doh! You're right. Thanks! It works now. Case closed. Again, thanks for the quick response and the help. I love the HP forums!
Vince Ungaro
Occasional Advisor

Re: Using find with fbackup

The suggestions above worked like a charm.