fully-qualified symlinks & --exclude question
Corey
corey at bitworthy.net
Sun Jun 22 22:26:52 GMT 2008
Greetings!
I've ran into a couple difficulties for a particular rsync use-case
I'm involved in implementing - hoping someone here might be able to
clue me in!
I've got an existing linux box, with a particular directory that needs
to be mirrored onto another server, into a different base path on that
server - i.e.:
server1:/var/lib/bar/ to server2:/backupdir/var/lib/bar/
Now, server1:/var/lib/bar/ contains hundreds of files which are each
symlink'd to one of a few files in the same directory:
/var/lib/bar/base_file1
/var/lib/bar/base_file2
/var/lib/bar/base_file3
/var/lib/bar/foo -> /var/lib/bar/base_file1
/var/lib/bar/bar -> /var/lib/bar/base_file3
/var/lib/bar/blah -> /var/lib/bar/base_file2
/var/lib/bar/goober -> /var/lib/bar/base_file2
The first problem is that these symlinks (on server1) are all using
the fully-qualified path - which is causing me problems because
/var/lib/bar/ doesn't exist on server2, but rather in
/backupdir/var/lib/bar/ ...
Is there a way of forcing rsync to link these relatively rather than
fully-qualitive? So that (for an exampe) the rsync from
server1:/var/lib/bar/foo to server2 ends up like:
server2:/backupdir/var/lib/bar/foo ->
server2:/backupdir/var/lib/bar/base_file1
rather than (what it's currently doing):
server2:/backupdir/var/lib/bar/foo -> server2:/var/lib/bar/base_file1
(...which results in a broken link)
Second question:
Is there a way of using --exclude to reference symlink _targets_, rather
than the filename itself?
For example:
/var/lib/bar/foo -> /var/lib/bar/base_file1
/var/lib/bar/blah -> /var/lib/bar/base_file2
/var/lib/bar/goober -> /var/lib/bar/base_file2
I want to use an --exclude which specifies: "all symlinks that link to
/var/lib/bar/base_file1 and /var/lib/bar/base_file2"
So, --exclude="foo blah" isn't what I'm after, because that will fail
to contain 'goober'... remember we're talking hundreds of symlinks -
pointing to just a couple/few target files; my --exclude would simply
be unmanageable.
Many thanks for any advice/solutions!
More information about the rsync
mailing list