diff options
-rwxr-xr-x | backup.sh | 27 |
1 files changed, 18 insertions, 9 deletions
@@ -40,7 +40,7 @@ main() { + /home/flo/.local/share/Steam/steamapps/common/Counter-Strike Global Offensive/csgo/cfg - /home/*/.local/share/Steam/steamapps/common/*/* - /home/*/.cache/* -- /home/*/.claws-mail/* +- /home/*/.claws-mail/imapcache - /root/.cache/* - /var/cache/pacman/pkg/* EOF @@ -49,7 +49,7 @@ EOF echo "$excludeList" > "$TMPDIR/exclude-list" # save some data that's useful for restores - backupDataDir=/root/backup-data/ + local backupDataDir=/root/backup-data/ mkdir -p "$backupDataDir" fdisk -l > "$backupDataDir/fdisk" vgdisplay > "$backupDataDir/vgdisplay" @@ -69,19 +69,28 @@ backup() { local src=$1 local dest=$2 shift 2 + local -a options=() + + if [[ $(date +%u ) == '1' ]]; then + # try to only run full backups on monday (1) + options+=(--full-if-older-than 2D) + else + # force a full backup once in a while + options+=(--full-if-older-than 20D) + fi #export PASSPHRASE duplicity \ - -v2 \ + --log-file /var/log/backup.log \ + -v5 \ --numeric-owner \ - --volsize 150 \ + --volsize 250 \ --allow-source-mismatch \ --asynchronous-upload \ - --full-if-older-than 30D \ --no-encryption \ - "$@" "$src" "$dest" + "${options[@]}" "$@" "$src" "$dest" - duplicity --force remove-older-than 120D "$dest" + duplicity --log-file /var/log/backup.log --force remove-older-than 120D "$dest" #export PASSPHRASE="" } @@ -124,9 +133,9 @@ exclude_mountpoints() { while read line; do local mountpoint=$(echo "$line" | cut -d\ -f2 | sed 's#\040# #g;') - type=$(echo "$line" | cut -d\ -f3) + local type=$(echo "$line" | cut -d\ -f3) - if in_array $type fuse.sshfs tmpfs cifs nfs fuseblk; then + if ! in_array $type "${fsWhitelist[@]}"; then if ! in_array_startswith "$mountpoint/" "${excludeMountpoints[@]}"; then error=1 echo "Warning: mountpoint not excluded: $mountpoint" >&2 |