diff --git a/jobs/transfer.job.dist b/jobs/transfer.job.dist index e4c071cc99aa161d99f49130d49b8cceb33ef1db..d3948e4c4c536792d445ef1bf0d0938922e1796b 100644 --- a/jobs/transfer.job.dist +++ b/jobs/transfer.job.dist @@ -12,63 +12,103 @@ # ---------------------------------------------------------------------- -# ---------------------------------------------------------------------- -# general settings -# ---------------------------------------------------------------------- -# encrypt backup sets with gnupg password -gnupg-passphrase = EnterYourSecretHere +# ...................................................................... +# backend: +# ...................................................................... +# +# ===== Duplicity: +# +# file based / Samba share +# storage = file:///some/where +# +# ssh connection: +# storage = rsync://bacup@storage.example.com//netshare/backup +# if rsync does not work try scp (is slower) +# storage = scp://backup@storage.example.com//netshare/backup +# +# ===== Restic +# DOCS: https://restic.readthedocs.io/ +# +# ssh connection: +# storage = sftp://backup@storage.example.com//netshare/backup +# +# https connection (requires a Http Rest server - i.e. Restic Http or Rclone http server) +# storage = rest:https://user:pass@host:8000/my_backup_repo/ +# +# +# +# ===== for scp/ sftp/ rsync transfer you need to add an ssh private key +# ssh-privatekey = /opt/imlbackup/client/keys/id_imlbackup@storage-connector.iml.unibe.ch +# +# HINT: if using scp:// on Debian 8 enable ssh-backend; default: no value +# duplicity_ssh-backend = pexpect -# time to keep backup sets on storage -# M - monthes -# Y - years -keep = 3M -# volume size on backup target -volsize = 350 +# ---------------------------------------------------------------------- +# BASIC settings +# ---------------------------------------------------------------------- -# use another cache directory than ~/.cache/duplicity/ -cachedir = +# what tool to use? one of duplicity|restic ... see plugins/transfer/*.sh +bin = restic +# bin = duplicity -# ---------------------------------------------------------------------- +# encrypt backup sets with a password +# remark: "gnupg-passphrase = ..." is deprecated +passphrase = EnterYourSecretHere -# automatic backup of samba shares -# if set to 1 and a local smb.conf is detected each share will be backupped -sambashares = 1 -# ---------------------------------------------------------------------- +# automatic backup of samba shares (only if samba shares were detected) +sambashares = 1 -# target directory for restore (duplicity does not overwrite any existing file) -# you need to copy files from here to the needed place restore-path = /restore # ---------------------------------------------------------------------- -# backup target url +# +# DUPLICITY +# values without prefix "duplicity_" are deprecated +# # ---------------------------------------------------------------------- -# target directory where to store the backups -# It is a base url for duplicity (behind it the hostname will be added) +# for fallback on Debian 8: +# ssh-backend = pexpect +# duplicity_ssh-backend = + +# time to keep backup sets on storage +# M - monthes +# Y - years +# keep = 6M +duplicity_keep = 6M + +# volume size on backup target im MB +# volsize = 350 +duplicity_volsize = 350 + +# use another cache directory than ~/.cache/duplicity/ +# cachedir = +duplicity_cachedir = + + +# ---------------------------------------------------------------------- # -# example I: -# use the local filesystem or (already) mounted device -# -# storage = file:///run/media/username/nas +# RESTIC # -# example II: -# use local filesystem or mounted device -# storage = scp://imlbackup@lithium.iml.unibe.ch//netshare/backup/one +# ---------------------------------------------------------------------- -# for file:// targets - you can add a test file that must be found -# to detect that a backup volume is mounted -# storage-file = /run/media/username/nas/I_am_mounted.txt +# use another cache directory than /root/.cache/restic +restic_cachedir = -# ssh-privatekey = /opt/imlbackup/client/keys/id_rsa_4_backupserver -ssh-privatekey = +restic_verbose = 2 +restic_tag = imlbackup -# for fallback on Debian 8: -# ssh-backend = pexpect -ssh-backend = +restic_mountpoint = /mnt/restore +# prune +restic_keep-hourly = 100 +restic_keep-daily = 90 +restic_keep-weekly = 12 +restic_keep-monthly = 12 +restic_keep-yearly = 10 # ---------------------------------------------------------------------- diff --git a/plugins/transfer/restic.sh b/plugins/transfer/restic.sh index 6512f89b9787bae9c96b70c6d961ab423b9b50e3..95f8a9838123c939f70056db476c6a0c876d457c 100644 --- a/plugins/transfer/restic.sh +++ b/plugins/transfer/restic.sh @@ -253,13 +253,15 @@ # Mount backup data function t_restoreDoMountBackupdata(){ local _cmd= - echo HINT: This feature requires fuse. It works on UNIX/ LINUX platforms - not on MS Windows. + echo HINT: This feature requires fuse. It works with root on UNIX/ LINUX platforms - not on MS Windows. echo if [ -z "$RESTIC_MOUNTPOINT" ]; then color error echo "ERROR: no mountpoint was set in ${STORAGEFILE}; example: restic_mountpoint = /mnt/restore" color reset else + j_requireUser "root" + test -d "$RESTIC_MOUNTPOINT" || mkdir -p $RESTIC_MOUNTPOINT _cmd="restic mount ${ARGS_DEFAULT} $RESTIC_MOUNTPOINT" test -z "${BACKUP_DIR}" || _cmd="restic mount ${ARGS_DEFAULT} --path ${BACKUP_DIR} $RESTIC_MOUNTPOINT" echo $_cmd