Advertisement
Guest User

Untitled

a guest
Aug 12th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Duplicity wrapper
  4. #
  5. # add to crontab:
  6. # 0 0 * * * /bin/sh /usr/local/sbin/backup-host.sh
  7.  
  8. set -e
  9.  
  10. PASSPHRASE="long_passphrase"
  11. DISK_USER="login@yandex.ru"
  12. DISK_PASSWORD=""
  13. BACKUP_DIR=/
  14. INCLUDES_EXCLUDES="\
  15. --exclude '/home/*/Downloads' \
  16. --exclude '/home/*/.cache' \
  17. --exclude '/home/*/tmp' \
  18. --exclude '/home/*/VirtualBox VMs' \
  19. --exclude '/home/*/mnt' \
  20. --exclude '/root/.cache' \
  21. --exclude '/root/tmp' \
  22. --include '/home' \
  23. --include '/root' \
  24. --include '/etc' \
  25. --include '/srv' \
  26. --include '/var' \
  27. --exclude '**'"
  28. DEST=webdavs://${DISK_USER}@webdav.yandex.ru/Backup/$(hostname)
  29.  
  30. export PASSPHRASE
  31. export FTP_PASSWORD=${DISK_PASSWORD}
  32.  
  33. DUPLICITY_CMD="duplicity \
  34. -v2 \
  35. --ssl-cacert-file /etc/ssl/certs/ca-certificates.crt"
  36.  
  37. CLEAN_CMD="${DUPLICITY_CMD} \
  38. remove-older-than 2M --force \
  39. ${DEST}"
  40.  
  41. BACKUP_CMD="${DUPLICITY_CMD} \
  42. --full-if-older-than 1M \
  43. ${INCLUDES_EXCLUDES} \
  44. ${BACKUP_DIR} \
  45. ${DEST}"
  46.  
  47. VERIFY_CMD="${DUPLICITY_CMD} \
  48. verify \
  49. ${INCLUDES_EXCLUDES} \
  50. ${DEST} \
  51. ${BACKUP_DIR}"
  52.  
  53. RESTORE_CMD="${DUPLICITY_CMD} \
  54. ${DEST} \
  55. ${PWD}"
  56.  
  57. echo ${CLEAN_CMD}; eval ${CLEAN_CMD}
  58. echo ${BACKUP_CMD}; eval ${BACKUP_CMD}
  59. echo ${VERIFY_CMD}; eval ${VERIFY_CMD}
  60. # echo ${RESTORE_CMD}; eval ${RESTORE_CMD}
  61.  
  62.  
  63. unset PASSPHRASE
  64. unset FTP_PASSWORD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement