diff options
Diffstat (limited to 'bin/workstation-duplicity')
-rwxr-xr-x | bin/workstation-duplicity | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/bin/workstation-duplicity b/bin/workstation-duplicity index d40681c3..c227f6ea 100755 --- a/bin/workstation-duplicity +++ b/bin/workstation-duplicity @@ -46,6 +46,7 @@ if ! [ -t 1 ]; then fi fi +set +e if [ -e "$FLAG_FILE" ]; then # attempt an incremental backup -- always incremental since we # might be running from a cronjob on weak coffee shop WiFi @@ -58,10 +59,25 @@ else # case files need to be restored duply $DUPLY_PROFILE full fi +exit=$? +set -e -# if it was successful, update flag file so cronjob doesn't do this -# again for four hours -touch $FLAG_FILE - -notify-send --urgency=low --icon=package_network \ - "duplicity incremental backup @ $(date '+%-l:%M%#p %Z')" ||: +if [ $exit = 0 ]; then + if [ -e "$FLAG_FILE" ]; then + type="incremental" + else + type="full" + fi + notify-send --urgency=low --icon=package_network \ + "duplicity $type backup @ $(date '+%-l:%M%#p %Z')" ||: + # update flag file so cronjob doesn't do this again for four hours + touch $FLAG_FILE +else + if nc -w1 -q0 ch-s012.rsync.net 22 </dev/null; then + msg="Looks like SSH to backup host is possible." + else + msg="We're online, but couldn't SSH to the backup host." + fi + notify-send --urgency=critical --icon=dialog-warning \ + "duplicity could not connect" "$msg" ||: +fi |