X-Git-Url: https://piware.de/gitweb/?p=bin.git;a=blobdiff_plain;f=backup;h=7a424862cc100015608c6cee15d85a5e0d62c5ae;hp=97046da9b460df5d51f9793415627fa31c0f6fe6;hb=08f7bdfac720173984d2e6846c5bf780f39916f7;hpb=3afaf24d18e8d2b1c45974d5c6126b88ea2026dd diff --git a/backup b/backup index 97046da..7a42486 100755 --- a/backup +++ b/backup @@ -2,6 +2,7 @@ set -eu cd $HOME LOG=.cache/duplicity/log +PATH=$PATH:/sbin:/usr/sbin # do backup every day if [ -e "$LOG" ] && [ $(( `date +%s` - `stat -c %Y $LOG` )) -lt 86300 ]; then @@ -11,7 +12,7 @@ fi # figure out $DISPLAY when running from cron export DISPLAY="${DISPLAY:-:0}" -if ! ip route | grep -q '^default.*wl'; then +if ! ip route show default | grep -Eq 'dev (enp|wl)'; then notify-send "Backup skipped, not on WLAN" exit 0 fi @@ -26,5 +27,6 @@ fi notify-send "Backup started" mkdir -p $(dirname $LOG) -env PASSPHRASE="$(cat ~/.backup-passphrase)" duplicity --full-if-older-than 1M --exclude-filelist .duplicity-ignore . rsync://piware.de/backup/donald >> $LOG || { notify-send "BACKUP FAILED!"; exit 1; } +env PASSPHRASE="$(cat ~/.backup-passphrase)" duplicity --allow-source-mismatch --full-if-older-than 1M --exclude-filelist .duplicity-ignore . rsync://piware.de/backup/laptop >> $LOG || { notify-send "BACKUP FAILED!"; exit 1; } notify-send "Backup finished successfully" +duplicity remove-all-but-n-full 6 --force rsync://piware.de/backup/laptop