diff options
author | Florian Pritz <bluewind@xinu.at> | 2015-12-05 13:54:51 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-12-05 13:54:51 +0100 |
commit | 81f0a194c53a5d74b646ac2981e26e3ef2614c84 (patch) | |
tree | bb6b7785ef92f184bb9e4e5f6c75c3ef37d61dbd | |
parent | bbf0d599692030185427d392d470fef7a8402944 (diff) | |
download | bin-81f0a194c53a5d74b646ac2981e26e3ef2614c84.tar.gz bin-81f0a194c53a5d74b646ac2981e26e3ef2614c84.tar.xz |
backup.sh: misc changes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-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 |