Backup with duplicity to yandex.disk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Duplicity wrapper | |
# | |
# add to crontab: | |
# 0 8 * * * /bin/sh /usr/local/sbin/backup-host.sh | |
set -e | |
PASSPHRASE="looooongpassphrase!@#$#^%&" | |
DISK_USER="user@yandex.ru" | |
DISK_PASSWORD="pass" | |
BACKUP_DIR=/ | |
INCLUDES_EXCLUDES="--exclude '/home/*/Downloads' \ | |
--exclude '/home/*/.cache' \ | |
--exclude '/home/*/Music' \ | |
--exclude '/home/*/pub' \ | |
--exclude '/home/*/tmp' \ | |
--exclude '/home/*/VirtualBox VMs' \ | |
--exclude /root/.cache | |
--include /home \ | |
--include /root \ | |
--include /etc \ | |
--include /srv \ | |
--exclude '**'" | |
DEST=webdavs://${DISK_USER}@webdav.yandex.ru/Backup/$(hostname) | |
export PASSPHRASE | |
export FTP_PASSWORD=${DISK_PASSWORD} | |
BACKUP_CMD="duplicity \ | |
--full-if-older-than 1M \ | |
--ssl-cacert-file /etc/ssl/certs/ca-certificates.crt \ | |
${INCLUDES_EXCLUDES} \ | |
${BACKUP_DIR} \ | |
${DEST}" | |
echo ${BACKUP_CMD} | |
eval ${BACKUP_CMD} | |
VERIFY_CMD="duplicity verify -v4 \ | |
--ssl-cacert-file /etc/ssl/certs/ca-certificates.crt \ | |
${INCLUDES_EXCLUDES} \ | |
${DEST} \ | |
${BACKUP_DIR}" | |
echo ${VERIFY_CMD} | |
eval ${VERIFY_CMD} | |
CLEAN_CMD="duplicity remove-older-than 2M --force \ | |
--ssl-cacert-file /etc/ssl/certs/ca-certificates.crt \ | |
${BACKUP_DIR}" | |
echo ${CLEAN_CMD} | |
eval ${CLEAN_CMD} | |
unset PASSPHRASE | |
unset FTP_PASSWORD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment