rbu
is a small shell script I created to backup files on a rolling basis (similar to syslog). rbu
takes an input file and copies it to <filename>.1
. If <filename>.1
already exists then it moves <filename>.1
to <filename>.2
. It repeats this process untill a maximum number of backups (MAX_BACKUPS
or -m
) is reached. Once the max is reached it continues rolling the files.
By default rbu
will not backup the file if the previous backup identically matches. This is to prevent numerous copies of the same backup. If you would like rbu
to backup the file no matter what then you can supply the -a
flag.
Save rbu somewhere in your $PATH
.
curl -LJ -o /usr/local/bin/rbu https://raw.githubusercontent.com/blockloop/rbu/master/rbu
chmod +x /usr/local/bin/rbu
docker run --rm -it blockloop/rbu -m 10 sqlite.db
Usage:
rbu parameters file
rbu [-d output_dir] [-m max_backups] [-a] <file>
Options:
-d <dir> The directory to write backups.
Default: dirname of <file>
Optionally use OUT_DIR environment variable
-m <num> Maximum number of backups to retain
Default: 5
Optionally use MAX_BACKUPS environment variable
-a Always perform backup regardless of change.
Default: false
Optionally use ALWAYS_BACKUP environment variable
-h display this help and exit