Bacula-users

Re: [Bacula-users] Following symlinks

2009-04-20 07:21:06
Subject: Re: [Bacula-users] Following symlinks
From: Kjetil Torgrim Homme <kjetilho AT linpro DOT no>
To: bacula-users AT lists.sourceforge DOT net
Date: Mon, 20 Apr 2009 13:16:57 +0200
Daniel Bareiro <daniel-listas AT gmx DOT net> writes:
> Kjetil Torgrim Homme wrote:
>> > Where the client can have a /space/log and/or /space/backup and
>> > the symlink can be in some subirectory of them. With this
>> > declaration of File, how I could force backup of symlinks?
>> 
>> if you have GNU find, try
>> 
>>    "\\|find /space/ -name backup -o -name log -printf '%l\\n'"
>> 
>> %l (small L) expands to what the symlink points to.  if you don't
>> have GNU find, use sed to add the trailing "/.", something like
>> 
>>    "\\|sh -c \"find /space/ -name backup -o -name log | sed s,$,/.,\""
>> 
>> note that the sed solution will also handle the case where
>> /space/log points to another symlink.
>
> The solution with sed works as your you indicate to me. The simple
> fact to add trailing "/." does that _all_ symlinks in these
> directories are followed?

it only modifies the output of find.

> With respect to the solution with find, it seems that it is having a
> behavior different from that you indicate. According to I read in
> the find man pages, %l talks about the object of symbolic link and
> empty string if file is not a symbolic link).

yes.  this way Bacula will backup the target of the symlink, in other
words, if /space/log points to /srv/foo/log, the find will emit
"/srv/foo/log", and as a result, the files will be stored in the
catalog as /srv/foo/log/*.  if you use the sed-trick, the files will
be recorded in the catalog as /space/log/*.

> The correct thing would be to use -L flag?

no, that would cause find to follow the symlinks and iterate through
the log directory (etc) as well, you don't want that.

-- 
Kjetil T. Homme
Redpill Linpro AS - Changing the game


------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>