4 LOG=.cache/duplicity/log
5 PATH=$PATH:/sbin:/usr/sbin
8 if [ -e "$LOG" ] && [ $(( `date +%s` - `stat -c %Y $LOG` )) -lt 86300 ]; then
12 # figure out $DISPLAY when running from cron
13 export DISPLAY="${DISPLAY:-:0}"
15 if ! ip route | grep -q '^default.*wl'; then
16 notify-send "Backup skipped, not on WLAN"
20 # figure out ssh agent when running from cron
21 if [ -z "${SSH_AUTH_SOCK:-}" ]; then
22 ssh_socket=$(ls /run/user/`id -u`/keyring*/ssh 2>/dev/null)
23 if [ -S "$ssh_socket" ]; then
24 export SSH_AUTH_SOCK="$ssh_socket"
28 notify-send "Backup started"
29 mkdir -p $(dirname $LOG)
30 env PASSPHRASE="$(cat ~/.backup-passphrase)" duplicity --allow-source-mismatch --full-if-older-than 1M --exclude-filelist .duplicity-ignore . rsync://piware.de/backup/donald >> $LOG || { notify-send "BACKUP FAILED!"; exit 1; }
31 notify-send "Backup finished successfully"
32 duplicity remove-all-but-n-full 6 --force rsync://piware.de/backup/donald