]> asedeno.scripts.mit.edu Git - sipb-mirrors.git/commitdiff
Fetch script for hudson without logging
authorQuentin Smith <quentin@mit.edu>
Mon, 7 Sep 2009 07:42:30 +0000 (03:42 -0400)
committerQuentin Smith <quentin@mit.edu>
Mon, 7 Sep 2009 07:42:30 +0000 (03:42 -0400)
fetch-hudson [new file with mode: 0644]

diff --git a/fetch-hudson b/fetch-hudson
new file mode 100644 (file)
index 0000000..907f72e
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+set -e
+
+. ./OPTIONS.sh
+
+scriptname=$1
+shift
+
+if [ -z "$scriptname" ]; then
+    echo "Run with a fetch script as an argument:"
+    (cd fetch-scripts && ls)
+    exit 1
+fi
+
+if ! [ -e fetch-scripts/"$scriptname" ]; then
+    echo "Unknown fetch script $scriptname"
+    exit 1
+fi
+
+date +"Starting $scriptname: %c"
+
+#NB: -r is number of retries, at 8 second intervals
+if lockfile -r 900 "$MIRRORDIR/.locks/$scriptname"; then
+    date +"Received lock: %c"
+    (. fetch-scripts/"$scriptname")
+    exitstatus=$?
+    rm -f "$MIRRORDIR/.locks/$scriptname"
+fi
+
+date +"Done: %c"
+exit $exitstatus