From: Jeffrey J. K. <bac...@ko...> - 2008-11-23 10:00:07
|
Several people have recently asked about whether it is possible to have some files backed up only occasionally or to keep some files for only a limited amount of time. One example is perhaps you want to always have the most recent couple of backups of your temp files so that if something crashes you can do a full restore but you don't want to save these files (nearly) forever. So, for example maybe you want the ability to have some files only saved for the last 'x' backups. Well, this can be done with some new logic that I added to my BackupPC_deleteFile program. Specifically, put the list of files that you want to keep for only a limited number of backups in a file say "agefile". So then if for example if you want to use non-mangled filenames for your file list and you want to only save the last 3 backups then add the following to your config.pl file: $Conf{DumpPostUserCmd} = 'BackupPC_deleteFile -h $host -s - -m -r -n -[4] -F agefile There are a couple of caveats: - The program is still 'beta' so don't use it for critical backups until your comfortable that it works for you. - The program cannot delete hard links or directories containing hard links. - The method can be slow if you are deleting really big & deep trees since files may need to be linked recursively forward from prior incremental backups. In any case, here is the broader description of options: usage: $0 [options] files/directories... Required options: -h host Host (or - for all) from which path is offset -n backRange Range of successive backup numbers to delete. N delete files from backup N (only) M-N delete files from backups M-N (inclusive) -M delete files from all backups up to M (inclusive) M- delete files from all backups up from M (inlusive) - delete files from ALL backups {N} if one of the numbers is in braces, then interpret as the N\'th backup counting from the *beginning* [N] if one of the numbers is in braces, then interpret as the N\'th backup counting from the *end* Optional options: -s shareName Share name (or - for all) from which path is offset (don\'t include the 'f' mangle) NOTE: if -s option not set, then file/directory names must include the share name -l Just list backups by host (with level noted in parentheses) -r Allow directories to be removed too (otherwise skips over directories) -m Paths are unmangled (i.e. apply mangle to paths) -F <file> Read files/directories from <file> (or stdin if <file> = -) -q Don\'t show deletions -t Trial run -- do everything but deletions -c Clean up pool - schedule BackupPC_nightly to run (requires server running) Only runs if files were deleted -d level Turn on debug level |