diff options
| author | Anton Bobov <abobov@gmail.com> | 2018-11-01 22:16:21 +0500 |
|---|---|---|
| committer | Anton Bobov <abobov@gmail.com> | 2018-11-01 22:16:21 +0500 |
| commit | 2bf34f4efd5643b847170443ca9aa03dafed976c (patch) | |
| tree | ed4f121a91f6a5f3214e4cea25c47475abd9e86d /d-backup | |
| parent | 88fcd4ab2ea43395da996ccfe067b3b5651eb458 (diff) | |
Update bin.
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 + |
