- if os.path.exists(path):
- return (time.time() - os.stat(path).st_mtime)/86400.
- else:
- return time.time()/86400.
-
-def rsnapshot(mode):
- argv = ['rsnapshot']
- if verbose:
- argv.append('-v')
- argv += ['-c', rsnapshot_conffile, mode]
- if verbose:
- print argv
- subprocess.call(argv)
-
-# daily
-if days_mod(os.path.join(rsnapshot_basedir, 'daily.0')) >= 1:
- rsnapshot('daily')
-elif days_mod(os.path.join(rsnapshot_basedir, 'weekly.0')) >= 7:
- rsnapshot('weekly')
-elif days_mod(os.path.join(rsnapshot_basedir, 'monthly.0')) >= 30:
- rsnapshot('monthly')
+notify-send "Backup started"
+mkdir -p $(dirname $LOG)
+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; }
+notify-send "Backup finished successfully"
+duplicity remove-all-but-n-full 6 --force rsync://piware.de/backup/donald