[Server-devel] [PATCH] Move cheaper checks earlier

martin.langhoff at gmail.com martin.langhoff at gmail.com
Mon Jun 16 13:46:36 EDT 2008


From: Martin Langhoff <martin at laptop.org>

With this each run is down to a minimum cost of 30ms.
---
 ds_backup.sh |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/ds_backup.sh b/ds_backup.sh
index 98547d1..4c89fbb 100755
--- a/ds_backup.sh
+++ b/ds_backup.sh
@@ -16,6 +16,22 @@
 # Author: Martin Langhoff <martin at laptop.org>
 #
 
+# If we have backed up recently, leave it for later. Use
+# -mtime 0 for "today"
+# -mtime -1 for "since yesterday"
+# -mtime -10 for in the last 10 days
+#
+# Using -daystart means that the script is more eager to backup
+# in the morning. Without -daystart, laptops backup "later in the day"
+# everyday, as they only start trying after 24hs...
+#
+# Another tack could be -mmin -1200 (20hs), which could be more stable.
+#
+if [ `find ~/.sugar/default/ds_backup-done -daystart -mtime 0 2>/dev/null` ]
+then
+    exit 0
+fi
+
 if [ -e /sys/class/power_supply/olpc-battery/capacity \
      -a -e /sys/class/power_supply/olpc-ac/online ]
 then
@@ -53,22 +69,6 @@ then
 	exit 0
 fi
 
-# If we have backed up recently, leave it for later. Use
-# -mtime 0 for "today"
-# -mtime -1 for "since yesterday"
-# -mtime -10 for in the last 10 days
-#
-# Using -daystart means that the script is more eager to backup
-# in the morning. Without -daystart, laptops backup "later in the day"
-# everyday, as they only start trying after 24hs...
-#
-# Another tack could be -mmin -1200 (20hs), which could be more stable.
-#
-if [ `find ~/.sugar/default/ds_backup-done -daystart -mtime 0 2>/dev/null` ]
-then
-    exit 0
-fi
-
 ##
 ## TODO: 
 ## - Test: Can we see the XS?
-- 
1.5.4.34.g053d9



More information about the Server-devel mailing list