Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Duplicity wrapper
- #
- # add to crontab:
- # 0 0 * * * /bin/sh /usr/local/sbin/backup-host.sh
- set -e
- PASSPHRASE="long_passphrase"
- DISK_USER="login@yandex.ru"
- DISK_PASSWORD=""
- BACKUP_DIR=/
- INCLUDES_EXCLUDES="\
- --exclude '/home/*/Downloads' \
- --exclude '/home/*/.cache' \
- --exclude '/home/*/tmp' \
- --exclude '/home/*/VirtualBox VMs' \
- --exclude '/home/*/mnt' \
- --exclude '/root/.cache' \
- --exclude '/root/tmp' \
- --include '/home' \
- --include '/root' \
- --include '/etc' \
- --include '/srv' \
- --include '/var' \
- --exclude '**'"
- DEST=webdavs://${DISK_USER}@webdav.yandex.ru/Backup/$(hostname)
- export PASSPHRASE
- export FTP_PASSWORD=${DISK_PASSWORD}
- DUPLICITY_CMD="duplicity \
- -v2 \
- --ssl-cacert-file /etc/ssl/certs/ca-certificates.crt"
- CLEAN_CMD="${DUPLICITY_CMD} \
- remove-older-than 2M --force \
- ${DEST}"
- BACKUP_CMD="${DUPLICITY_CMD} \
- --full-if-older-than 1M \
- ${INCLUDES_EXCLUDES} \
- ${BACKUP_DIR} \
- ${DEST}"
- VERIFY_CMD="${DUPLICITY_CMD} \
- verify \
- ${INCLUDES_EXCLUDES} \
- ${DEST} \
- ${BACKUP_DIR}"
- RESTORE_CMD="${DUPLICITY_CMD} \
- ${DEST} \
- ${PWD}"
- echo ${CLEAN_CMD}; eval ${CLEAN_CMD}
- echo ${BACKUP_CMD}; eval ${BACKUP_CMD}
- echo ${VERIFY_CMD}; eval ${VERIFY_CMD}
- # echo ${RESTORE_CMD}; eval ${RESTORE_CMD}
- unset PASSPHRASE
- unset FTP_PASSWORD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement