diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-01-10 00:15:15 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2014-01-10 00:15:15 +0100 |
commit | 80154a7e0c10303928ae802ff5af4e0809bf65c3 (patch) | |
tree | b9b2d20ac100471f36727ea6d73ff093843e5f26 | |
parent | a61487ea842a83b927c689f3b38fbb3edd289b8a (diff) | |
download | bin-80154a7e0c10303928ae802ff5af4e0809bf65c3.tar.gz bin-80154a7e0c10303928ae802ff5af4e0809bf65c3.tar.xz |
add backup.sh
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | backup.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/backup.sh b/backup.sh new file mode 100644 index 0000000..9eef9f3 --- /dev/null +++ b/backup.sh @@ -0,0 +1,39 @@ +#!/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="" |