diff options
Diffstat (limited to 'd-backup')
| -rwxr-xr-x | d-backup | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/d-backup b/d-backup new file mode 100755 index 0000000..090b672 --- /dev/null +++ b/d-backup @@ -0,0 +1,59 @@ +#!/bin/bash +# +# Example content of duplicity.conf, keep file root:root and only owner 0600 +# ---------------- 8< -------------------- +# FTP_PASSWORD="ftp_password" +# PASSPHRASE="passphrase" +# TARGET="sftp://server/path" +# ---------------- 8< -------------------- + +if [ ! $(whoami) = root ] ; then + echo "This script must be run by the user: root" + exit 1 +fi + +HOME=/home/anton + +source "$HOME/.duplicity.conf" +SOURCE=/ + +print_help() { + cat <<EOF +Commands: + backup run backup + stats show collection status +EOF +} + +backup() { + duplicity cleanup --force "$TARGET" + duplicity \ + --exclude-filelist "$HOME/.duplicity-exclude" \ + --full-if-older-than 2M \ + "$SOURCE" "$TARGET" +} + +stats() { + duplicity collection-status "$TARGET" +} + +if [[ $# = 0 ]] ; then + print_help + exit 0 +fi + +while (( "$#" )) ; do + case "$1" in + backup) + backup + ;; + stats) + stats + ;; + *) + print_help + ;; + esac + shift +done + |
