3782cdf528 | ||
---|---|---|
README.md | ||
bare.sh | ||
report.sh |
README.md
Overview
Bash wrapper for restic backups.
Requirements
Usage
root@gridbug:bare# ./bare.sh -h
usage: ./bare.sh command reponame
-a Run on all repos defined as 'auto'
-d dir Restore mode: specify where to put restored files (default: /mnt/restore)
-h Show this usage text
-s num Limit speed to 'num' Mbps (default: unlimited)
-x num Use 'num' simultaneous connections (default: 20)
-c Cron mode - log to /var/log/backup.log
-t Test mode - dump what would be done then exit.
-T Telegram fornatting mode
Valid commands are:
go ls init repos stats diff forget get check
/root/.backup/config should look like this:
export B2_ACCOUNT_ID=xxx # Backblaze B2 credentials
export B2_ACCOUNT_KEY=xxx # Backblaze B2 credentials
export B2_APP_ID=xxx # Backblaze B2 bucket details
export B2_APP_KEY=xxx # Backblaze B2 bucket auth
export B2_BUCKET_PREFIX=xxx # Prefix to append to create unique B2 bucket name
export RESTIC_KEEPDAYS=31 # Days to keep restic backups for
export RESTICOPTS="--one-file-system" # Extra args to pass to restic
export PGUSER=postgres # Postgresql username
export DEF_RSYNC_SERVER=xxx # Server used for repos with 'rsync' tag
export DEF_RSYNC_USER=backups # Username for rsync server
export DEF_RSYNC_DIR=/home/backups/backups # Remote directory on rsync server
export RSYNC_OPTIONS=-Pavz # Options to pass to rsync
export USMB_PREFIX=/DataVolume/shares # Strip this from repo path to get USMB share name
export DEF_NFS_SERVER=nfs.yourdomain.com # NFS server where local files for 'nfs' repos are found
export DEF_NFS_SERVER_BASE=/remote/nfs/share/base # Path on local NFS server to prefix to repo names
export NFS_PREFIX=/local/nfs/mountpoint # Where to mount NFS exports locally before backing them up
/root/.backup/repos should look like this:
reponame1;/path/to/files1/;tag1,tag2,...,tagX;repo_url;repo_passfile;repo_excludefile
reponame2;/path/to/files2/;tag1,tag2,...,tagX;repo_url;repo_passfile;repo_excludefile
...
reponameX;/path/to/filesX/;tag1,tag2,...,tagX;repo_url;repo_passfile;repo_excludefile
Default password file is: /root/.backup/auth
Backup method tags:
restic Backup using restic (default repo is Backblaze B2 bucket $B2_BUCKET_PREFIX-<reponame>)
rclone Backup using rclone (default repo is Backblaze B2 bucket $B2_BUCKET_PREFIX-<reponame>)
rsync Backup using rsync (default repo is $DEF_RSYNC_USER@$DEF_RSYNC_SERVER:$DEF_RSYNC_DIR/<reponame>)
postgres Dump all postgres databases. Instead of local file path, specify database name to backup. If empty, all dbs are backed up.
Pre-backup commands to access local files:
nfs Mount $DEF_NFS_SERVER:$DEF_NFS_SERVER_BASE/<sharename> to <repopath>
before running. Sharename determined by stripping $NFS_PREFIX
from start of repo path.
usmb Run 'usmb reponame' to mount $USMB_PREFIX/<sharename> before running.
Sharename determined by stripping $NFS_PREFIX from start of <repopath>.
localmount Run 'mount reponame' to mount <path_to_files> before running.
Pre-backup commands to access repo:
premount=x Run 'mount <x>' before command and 'umount x' afterwards.