Fixed code block

This commit is contained in:
Rob Pearce 2021-06-03 10:07:47 +10:00
parent 56375c80a0
commit 3782cdf528
1 changed files with 51 additions and 49 deletions

100
README.md
View File

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