BackupPC-users

Re: [BackupPC-users] Syntax for BackupFilesExclude

2008-09-29 22:12:31
Subject: Re: [BackupPC-users] Syntax for BackupFilesExclude
From: Holger Parplies <wbppc AT parplies DOT de>
To: Christian Völker <chrischan AT knebb DOT de>
Date: Tue, 30 Sep 2008 04:08:33 +0200
Hi,

Christian Völker wrote on 2008-09-27 05:29:06 +0200 [[BackupPC-users] Syntax 
for BackupFilesExclude]:
> On the first steps with BackupPC I used the "--one-file-system" for
> rsync which works fine for testing purpose.
> 
> But now I want to include some more directories and not only /

in my opinion, -x is still a good idea. Name the filesystems you want to back
up explicitly (see $Conf{RsyncShareName}) and avoid surprises resulting from
filesystems unexpectedly mounted during backup.

> So I figured out $Conf{BackupFilesExclude} would be the parameter to use.
> 
> Currently I'm only using rsync as tranfer methods as all hosts are Linux
> boxes.
> 
> Now I created a file under /etc/BackupPC/pc host.pl and added the
> following statement:
> 
> $Conf{BackupFilesExclude} = {
> ~  '*.isa' => [
> ~    ''
> ~  ]
> };
> 
> I think the above is wrong as it doesn't work. But how is the correct way?

Leave out the "~"s and name the share and what you want to exclude correctly :).
You mean something like any of the following:

  $Conf{BackupFilesExclude} = [ '*.isa' ];
  $Conf{BackupFilesExclude} = { '*' => [ '*.isa' ] };
  $Conf{BackupFilesExclude} = { '/' => [ '*.isa' ] };
  $Conf{BackupFilesExclude} = { '/' => [ '/foo/**/*.isa' ] };
  $Conf{BackupFilesExclude} = [ '/path/to/.isa/files/*.isa' ];

> I don't understand the documentation for this statement. I can exclude a
> whole directory like this:
> [...]
> What would be the syntax if I want to exclude only some files from a
> specified folder (or some flies globally on this host)?

You name the files (or flies) instead of the directories. Surprising?

See rsync(1) (that's the man page for rsync) under "INCLUDE/EXCLUDE PATTERN
RULES" for a detailed description of what wildcards you can use and what your
patterns are matched against.

Concerning the BackupPC part of things, a hash (something in curly braces)
lets you name specific excludes per share:

  $Conf{BackupFilesExclude} = {
     'sharename1' => [ 'list', 'of', 'excludes', 'for', 'share', '1' ],
     'sharename2' => [ 'you', 'get', 'the', 'idea' ],
     '*' => [ 'defaults', 'for', 'shares', 'not', 'named', 'explicitly' ]
  };

(don't ask me why anyone would exclude files named like that).
An array (in []) introduces one list that is to be used for all shares. Don't
confuse that with the arrays *within* the hash you see above.

As for the Perl part of things, avoid using barewords like

  $Conf{BackupFilesExclude} = tmp;

That almost definitely won't parse correctly if you happen to have things like
division operators in your file names ;-).

Regards,
Holger

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

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