|
NAMEfileprune - prune a file set according to a given age distributionSYNOPSISfileprune [-n|-N|-p] [-c count|-s size[k|m|g|t]|-a age[w|m|y]] [-e base|-g standard deviation|-f] [-t a|m|c] [-FKYv] file ...fileprune -d -n|-N [-c count |-a age[w|m|y]] [ -e base|-g standard deviation|-f] [-FKYv] date ... DESCRIPTIONFileprune will delete files from the specified set targeting a given distribution of the files within time as well as size, number, and age constraints. Its main purpose is to keep a set of daily-created backup files in manageable size, while still providing reasonable access to older versions. Specifying a size, file number, or age constraint will simply remove files starting from the oldest, until the constraint is met. The distribution specification (exponential, Gaussian (normal), or Fibonacci) provides finer control of the files to delete, allowing the retention of recent copies and the increasingly aggressive pruning of the older files. The retention schedule specifies the age intervals for which files will be retained. As an example, an exponential retention schedule for 10 files with a base of 2 will be
The above schedule specifies that for the interval of 65 to 128 days there should be (at least) one retained file (unless constraints and options override this setting). Retention schedules are always calculated and evaluated in integer days. By default fileprune will keep the oldest file within each day interval allowing files to migrate from one interval to the next as time goes by. It may also keep additional files, if the complete file set satisfies the specified constraint. The algorithm used for pruning does not assume that the files are uniformly distributed; fileprune will successfully prune file collections stored at irregular intervals. OPTIONS
EXAMPLEssh remotehost tar cf - /datafiles >backup/`date +'%Y%m%d'`fileprune -e 2 backup/* Backup remotehost, storing the result in a file named with today's timestamp (e.g. 20021219). Prune the files in the backup directory so that each retained file's age will be double that of its immediately younger neighbor. fileprune -N -d -e 1.2 -c 40 *
fileprune -g 365 -c 30 *
fileprune -e 2 -s 5G *
fileprune -F -e 2 -s 5G *
fileprune -K -e 2 -s 5G *
fileprune -a 1m -f
SNAPSHOTS=/tmp/snapshots.$$ ec2-describe-snapshots --filter status=completed | awk '$1 == "SNAPSHOT" {print $2, substr($5, 1, 10)}' | sort -k2 >$SNAPSHOTS fileprune -n -d -e 1.2 -c 40 `awk '{print $2}' $SNAPSHOTS` | sort | join -1 1 -2 2 -o 2.1 - $SNAPSHOTS | xargs -n 1 ec2-delete-snapshot rm -f $SNAPSHOTS Prune AWS-hosted daily snapshots to leave 40. SEE ALSOnewsyslog(8)AUTHOR(C) Copyright 2002-2016 Diomidis Spinellis.BUGSThe Gaussian (normal) distribution is calculated by trying successive increments of the normal function's distribution function. If the file number or count is large compared to the specified standard deviation, the calculation may take an exceedingly long time. To get results in a reasonable time, day increments are bounded at 10 times the increment of the previous interval and a total age of 100 years. It is advisable to first calculate and print the pruning schedule with a command likefileprune -g 100 -p -c 20 to ensure that the schedule can be calculated.
Visit the GSP FreeBSD Man Page Interface. |