Welcome! » Log In » Create A New Profile

rsync exclusion list - apply to multiple shares

Posted by cardiganimpatience 
I was under the incorrect assumption that specifying an asterisk would apply the exclusion list to all ShareNames until I struggled with making it work and re-read the tutorial [1] where it specifies that the asterisk "means it applies to all shares that don't have a specific entry".

$Conf{BackupFilesExclude} = {
'*' => [
'*access_log*',
'.apdisk',
'*/.apdisk',
'.cache'
]

Is there a method to make an exclusion list for [i]all shares[/i], even if individual shares have specific lists of their own? For example, I want to exclude the /var/lib/mysql folder on the /var share, but I also want to exclude any directory named .cache from all shares.

Would it be valid to list all shares in a common definition, and also break them out into individual lists like this:

$Conf{BackupFilesExclude} = {
'/home, /var, /usr, /boot, /data' => [
'*access_log*',
'.apdisk',
'*/.apdisk',
'.cache'
]

$Conf{BackupFilesExclude} = {
'/var' => [
'/lib/mysql'
]

My list of files to exclude from every ShareName includes over 40 items so it's not trivial (or aesthetically pleasing) to append this list to each share definition.

[1] http://backuppc.sourceforge.net/faq/BackupPC.html#_conf_backupfilesexclude_
Just following up on this because I got a very useful reply from Holger which explained that a variable can be used to hold a list of excludes, but noted that doing so will break the ability to use the GUI. If the GUI is used to edit a host's config after manually setting a variable all changes will be overwritten.

From Holger:

You simply create a variable in the host (or even global) config file ...
[code]
my @common_excludes = ('*access_log*', '.apdisk', '.cache');
[/code]
and then reference that multiple times:
[code]
$Conf {BackupFilesExclude} = {
'/home' => [ @common_excludes ],
'/var' => [ @common_excludes, '/lib/mysql' ],
'/usr' => [ @common_excludes ],
'/boot' => [ @common_excludes ],
'/data' => [ @common_excludes ],
};
[/code]
or
[code]
$Conf {BackupFilesExclude} = {
'/var' => [ @common_excludes, '/lib/mysql' ],
'/example' => [ ], # no excludes here
'*' => [ @common_excludes ],
};
[/code]

Thanks Holger for your help! I've implemented it and it saves me much messiness in my config files. 8)
I'm following up on the global variable idea that was mentioned earlier:

From Holger:
You simply create a variable in the host (or even global) config file ...
my @common_excludes = ('*access_log*', '.apdisk', '.cache');

and then reference that multiple times:
$Conf {BackupFilesExclude} = {
'/home' => [ @common_excludes ],
----
I'd like to use a global variable so I can re-use the exclusion list. I'm not much of a perl coder so could someone help me understand how would that work? Would I define it in the main config.pl file and reference it in the pc-specific configs? Or would I create a file "common_excludes" and 'source' that file into each config?
Thanks!
Sorry, you do not have permission to post/reply in this forum.