From 81f0a194c53a5d74b646ac2981e26e3ef2614c84 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sat, 5 Dec 2015 13:54:51 +0100 Subject: backup.sh: misc changes Signed-off-by: Florian Pritz --- backup.sh | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'backup.sh') diff --git a/backup.sh b/backup.sh index 0db62a3..a59cf3e 100755 --- a/backup.sh +++ b/backup.sh @@ -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 -- cgit v1.2.3-24-g4f1b