#!/bin/sh # define a host "backup" in root's .ssh/config # create the globbing filters or remove the argument to backup() if [[ $UID != 0 ]]; then echo "Error: need root" >&2 exit 1 fi export HOME=/root # remove --no-encryption below if you set a passphrase #PASSPHRASE="randomstringhere" backup() { src=$1 dest=$2 shift 2 duplicity \ --exclude-other-filesystems \ -v2 \ --volsize 50 \ --allow-source-mismatch \ --asynchronous-upload \ --full-if-older-than 30D \ --ssh-backend pexpect \ --no-encryption \ "$@" "$src" "$dest" duplicity --ssh-backend pexpect --force remove-older-than 120D "$dest" } #export PASSPHRASE backup / sftp://backup/backup/root/ --exclude-globbing-filelist /root/duplicity_root_filter backup /home/ sftp://backup/backup/home/ --exclude-globbing-filelist /root/duplicity_home_filter backup /boot/ sftp://backup/backup/boot/ #export PASSPHRASE=""