Hi, John Buttery wrote on 30.01.2007 at 17:16:53 [[BackupPC-users] BackupPC exclusion per-share using arrays in $Conf{BackupFilesExclude}]: > I'm wondering if I've got the syntax right for this stuff...it looks > right, but I can't find any actual examples anywhere and some of the > files that I think should be excluded by this, aren't. > [...] > ----- cut here > $Conf{XferMethod} = 'rsync'; > $Conf{RsyncShareName} = ['/','/usr','/var','/home']; > ----- cut here > $Conf{BackupFilesExclude} = { > '/' => [ > '/dev', > '/tmp', > '/mnt', > '/floppy', > '/cdrom', > '/proc' > ], > > '/var' => [ > '/log/maillog', > '/lib/mysql/data', > '/lib/mysql/mysql', > '/log/mysql/mysql.log', > '/log/mysql/mysql-bin*', > '/spool/exim4' > ], > }; > ----- cut here
seems correct, but: do your RsyncArgs include --one-file-system (or -x)? If not, the files you are trying to exclude might be included in unexpected ways (eg. /log/maillog relative to /var would not be excluded if seen as /var/log/maillog relative to /). I'm not exactly sure though, what would happen if you backed up ['/', '/usr', '/var', '/home'] *without* --one-file-system. > When excluding directories, do I need to put a trailing '/' character? No, but you can. '/foo/' will match /foo (relative to the "share") only if it is a directory. A *file* /foo would be backed up, as would a *softlink* /foo, even if it points to a directory (only the softlink though, not the directory it points to). Obviously, only either a file or a directory (or a softlink) of the same name can exist at one point in time. If a directory is matched by an exclude, and it is thus excluded, then so are its contents. So, with absolute paths (and without wildcards), you usually don't need a trailing /, because you know which directories you are referring to, and that they will always be directories and not suddenly files. You *should* add the / if you anticipate replacing the directory with a softlink to someplace else, and would want the softlink included. > Are wildcards allowed? Yes, the shell metacharacters * and ? and character sets in []. Additionally, there is a ** which also matches path separators (slashes). /usr/*/bin/foo would match /usr/X11R6/bin/foo but not /usr/bin/foo or /usr/share/backuppc/bin/foo, /u**/foo would match both /usr/X11R6/bin/foo and /usr/bin/foo (and maybe /unix/is/great/fun/foo). > When specifying directory names inside the > per-share array, do I put the leading '/' characters? If you want to match to be anchored, then yes. bin/bar would match /bin/bar, /usr/bin/bar, /usr/X11R6/bin/bar and so on. /bin/bar will only match /bin/bar. These examples assume a "share" / - '/usr' => [ '/bin/foo' ] would only match a file /usr/bin/foo, *not* /bin/foo. You've got that correct, I just wanted to emphasize it. This is where trailing slashes might come in. *.iso/ would match only directories named <something>.iso, not files, and log/ would match only log directories, not files named "log". For more details, look at the rsync man page, section "INCLUDE/EXCLUDE PATTERN RULES". > Also, this backup fails with the following error [...] > - hostname (aborted by signal=ALRM) That is usually an indication that you should increase $Conf{ClientTimeout}, especially if it always happens roughly at the same time (by default when the backup job has been running for two hours). Just double the value or add a zero (at the end :) and see if that changes anything. If you don't have '--one-file-system', add that first. Backing up first everything, then /usr, then /var and then /home might take longer than just doing it once (if that is what happens) ;-). Regards, Holger ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/backuppc-users http://backuppc.sourceforge.net/