From Kromonos, 3 Years ago, written in Bash.
Embed
  1. #!/bin/bash
  2.  
  3. BORG_PASSPHRASE="ULTRA_STRONG_PASSWORD"
  4. REPOSITORY="/home/backup/borg/`uname -n`"
  5.  
  6. export BORG_PASSPHRASE
  7.  
  8. echo "Backup started..." | /usr/bin/systemd-cat -t "borg"
  9.  
  10. # backup
  11. borg create -v -C lz4 \
  12. $REPOSITORY::`hostname`-`date +%Y-%m-%dT%H:%M` \
  13. /etc \
  14. /home \
  15. /root \
  16. /srv \
  17. /var \
  18. /usr/local/bin \
  19. /boot/syslinux/syslinux.cfg \
  20. --exclude '*shadow*' \
  21. --exclude '/etc/ca-certificates' \
  22. --exclude '/etc/ssl/certs' \
  23. --exclude '/home/backup/borg' \
  24. --exclude '/srv/repo' \
  25. --exclude '/var/cache' \
  26. --exclude '/var/lib/pacman' \
  27. --exclude '/var/log' \
  28. --exclude '/var/run' \
  29. --exclude '/var/tmp'
  30.  
  31. # Remove old backup
  32. borg prune -v $REPOSITORY --prefix `hostname`- --keep-daily=7 --keep-weekly=4 --keep-monthly=6