Schedule a backup run for 10 minutes time.
authorAndrew Ruthven <andrew@etc.gen.nz>
Wed, 25 Jun 2014 08:32:02 +0000 (20:32 +1200)
committerAndrew Ruthven <andrew@etc.gen.nz>
Wed, 25 Jun 2014 08:32:02 +0000 (20:32 +1200)
NetworkManager/dispatcher.d/20network-shares

index 2159099..9ecf3d6 100755 (executable)
@@ -11,10 +11,11 @@ then
     mactest=$(arp -n -a $gateway | awk '{print $4}' | head -1)
 fi
 
-        date >> /tmp/nm.set
-        echo "$1 $2" >> /tmp/nm.set
-        set >> /tmp/nm.set
-        echo >> /tmp/nm.set
+date >> /tmp/nm.set
+echo "$1 $2" >> /tmp/nm.set
+set >> /tmp/nm.set
+echo >> /tmp/nm.set
+
 case "$2" in
     up|vpn-up)
         if [ "$CONNECTION_UUID" == "$targetuuid" -o "$CONNECTION_UUID" == "$vpnuuid" -o "$mactest" == "$targetmac" ]
@@ -27,6 +28,14 @@ case "$2" in
             do
                 sudo -u $user /usr/bin/network-bookmarks-add
             done
+
+           # Schedule a backup run for 10 minutes name - makes sure we don't
+           # try and do a backup if someone is only hoping on the network for
+           # a short time.
+            if [ -f /usr/lib/etc-obnam/run-backup ]
+            then
+                echo /usr/lib/etc-obnam/run-backup | at now + 10 minutes
+            fi
         else
             echo "On a foreign network, make sure we clean up" >> /tmp/nm.set
             for user in $(ls /home/*/.gtk-bookmarks | sed 's/\/home\///; s/\/.*//')