Hi all,

This message is an answer to a quite old topic: see below.
The main concern is that the current version of File::RsyncP does not support the "--prune-empty-dirs" option passed to an rsynd server. However this option is quite usefull when one wants to limit a backup to specific set of file types, because it makes the rsyncd daemon forget about all the directories that don't contain any of the required files and therefore would be empty.

As far as BackupPC is concerned I found a way to avoid the backup of those empty directories. It is based on a DumpPostShareCmd script. Of course, a patch of File::RsyncP to support the --prune-empty-dirs option would be better, because it would reduce the communication overhead between the client and the daemon, but I didn't dare working on that !

I'm not sure that my script is the best way of avoiding those empty dirs, and moreover I cannot ensure that there are no sideeffects, but I post it here so that you can give me some feedbacks. Basically, this script parses the temporary "TopDir/pc/$host/new/f$share" directory and simply deletes each directory that is empty or simply contain the single "attrib" file.

This script should be called in the DumpPostShareCmd as "/path/to/RemoveEmptyDirs.pl $host $share"

#! /usr/bin/perl -W
use File::Find;

my $base="/home/backuppc/data/pc"; # <-- to be adapted according to your local settings
my $host=shift @ARGV;
my $share=shift @ARGV;

my $dir="$base/$host/new/f$share";

if (-d $dir)
{
   finddepth( {
       no_chdir => 1,
       wanted => sub {
               $d = $_;
               return unless -d $d;

               opendir D, $d;
               my @list = readdir D;
               closedir D;

               return if @list > 3;
               unlink "$d/attrib" if ( @list == 3 && -f "$d/attrib" );

               rmdir $d;
             }
       }, $dir );
}

Hope this little trick will help other users like me.
Regards,
Jean-Michel.


 Re: [BackupPC-users] rsyncp problem --prune-empty-dirs

Bernhard Ott
Sun, 25 Feb 2007 14:10:47 -0800

Holger Parplies wrote:
 presuming I had a new enough version of rsync for the man page to
include an
explanation of what '--prune-empty-dirs' does, I'd probably be asking, why
you would want to use that.
It's the only way (as far as I understood the rsync-man page) to include
a directory recursively. The downside is, that the whole tree is
included (containing only directories but no files) which makes it
difficult to find the backup files for recovery.
I tried the $Conf{BackupFilesOnly} first, but that didn't work.

Generally speaking, you can't just add any option your client side rsync
might support. Some options might work, some might be silently ignored,
others will break things. Is '--prune-empty-dirs' a request to the server
side rsync process (modifying the file list) or to the client side
(File::RsyncP in this case), or does it even affect the protocol exchange
between both? File::RsyncP is known not to support all rsync options, much
less recent extensions.
I was afraid to hear that;-)

This seems to indicate you are not running the latest version of
File::RsyncP. Which version are you running?
Debian says 0.64-1, backuppc is 2.1.2pl1


Sending args: --server --sender --numeric-ids --perms --owner --group -D --links --times --block-size=2048 --recursive --prune-empty-dirs -D --ignore-times . .


This does not seem to agree with your config file.
you're right - I have to check that ...


Are you sure your --include and --exclude options are compatible with what
BackupPC generates? Are '--include=**/' and '--prune-empty-dirs' compatible?
Syntax is from manpage and, as mentioned above, the only way to solve my "problem" including a specific pattern (directory) wherever it shows up in the tree. rsync -avm [EMAIL PROTECTED]::share --include=*/ --include=MIT_ALLES/* --exclude=* works as expected. The main problem for me was to find out how backuppc and the different transfer methods deal with $Conf{BackupFilesOnly}-values: I still have to work on that next week ;-) Unfortunately I deleted the complete pc-directory (including the log files), so I have to set up a new host.pl.

Kind regards,
Bernhard

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
BackupPC-users mailing list
[email protected]
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Reply via email to