[Server-devel] [PATCH 1/4] ds_backup.sh: Keep the lockfile

martin.langhoff at gmail.com martin.langhoff at gmail.com
Thu Jun 19 14:46:15 EDT 2008


From: Martin Langhoff <martin at laptop.org>

There's no need to rm the lockfile. Keep it, save NAND cycles.

Thanks to Michael Stone for the hint.
---
 ds_backup.sh |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ds_backup.sh b/ds_backup.sh
index 76db42c..9916334 100755
--- a/ds_backup.sh
+++ b/ds_backup.sh
@@ -107,9 +107,10 @@ skip_ifrecent;
 skip_onlowbatt;
 skip_noschoolnet;
 
-### Ok, we are going to atte,pt a backup
+### Ok, we are going to attempt a backup
 
 # make the lock dir if needed
+# we will keep the (empty) file around
 if [ ! -d ~/.sugar/default/lock ]
 then
     mkdir ~/.sugar/default/lock || exit 1;
@@ -135,8 +136,8 @@ LOCKFILE=~/.sugar/default/lock/ds_backup.run
 flock -n $LOCKFILE `dirname $0 `/ds_backup.py
 EXITCODE=$?
 
-# Clean up the lock - if we can ;-)
-rm $LOCKFILE 2>/dev/null
+# Note: we keep the lockfile around to save
+# NAND cycles.
 
 # Propagate the exit code of the flock/ds_backup invocation
 exit $EXITCODE
-- 
1.5.4.34.g053d9



More information about the Server-devel mailing list