summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtcwg-generate-source-cache.sh (renamed from tcwg-update-snapshots_ref.sh)40
-rwxr-xr-xtcwg-rsync-dir.sh58
2 files changed, 58 insertions, 40 deletions
diff --git a/tcwg-update-snapshots_ref.sh b/tcwg-generate-source-cache.sh
index a2f1f87a..38a859ec 100755
--- a/tcwg-update-snapshots_ref.sh
+++ b/tcwg-generate-source-cache.sh
@@ -99,43 +99,3 @@ update_git_repos
echo "Snapshots status:"
du -hs $snapshots_dir-new/*
-
-# "if true" is to have same indent as configure-machine.sh hunk from which
-# handling of parallel runs was copied.
-if true; then
- declare -A pids
- declare -A results
-
- todo_machines="$@"
-
- for M in $todo_machines; do
- (
- rsync -az --delete $snapshots_dir-new/ $M:$snapshots_dir-new/
- ssh -fn $M "flock -x $snapshots_dir.lock -c \"rsync -a --delete ${snapshots_dir}-new/ $snapshots_dir/\""
- ) > /tmp/update-snapshots-ref.$$.$M 2>&1 &
- pids[$M]=$!
- done
-
- for M in $todo_machines; do
- set +e
- wait ${pids[$M]}
- results[$M]=$?
- set -e
-
- sed -e "s/^/$M: /" < /tmp/update-snapshots-ref.$$.$M
- rm /tmp/update-snapshots-ref.$$.$M
- done
-
- all_ok="0"
- for M in $todo_machines; do
- if [ ${results[$M]} = 0 ]; then
- result="SUCCESS"
- else
- result="FAIL"
- all_ok="1"
- fi
- echo "$result: $M"
- done
-
- exit $all_ok
-fi
diff --git a/tcwg-rsync-dir.sh b/tcwg-rsync-dir.sh
new file mode 100755
index 00000000..ea2361e8
--- /dev/null
+++ b/tcwg-rsync-dir.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+
+snapshots_dir=
+verbose=false
+
+OPTS="`getopt -l dir:,verbose: -- "$@"`"
+while test $# -gt 1; do
+ case $1 in
+ --dir) snapshots_dir="$2"; shift ;;
+ --verbose) verbose="$2"; shift ;;
+ esac
+ shift
+done
+
+if $verbose; then
+ set -x
+fi
+
+if [ x"$snapshots_dir" = x"" ]; then
+ echo "ERROR: --dir DIR not specified"
+ exit 1
+fi
+
+declare -A pids
+declare -A results
+
+todo_machines="$@"
+
+for M in $todo_machines; do
+ (
+ rsync -az --delete $snapshots_dir-new/ $M:$snapshots_dir-new/
+ ssh -fn $M "flock -x $snapshots_dir.lock -c \"rsync -a --delete ${snapshots_dir}-new/ $snapshots_dir/\""
+ ) > /tmp/update-snapshots-ref.$$.$M 2>&1 &
+ pids[$M]=$!
+done
+
+for M in $todo_machines; do
+ set +e
+ wait ${pids[$M]}
+ results[$M]=$?
+ set -e
+
+ sed -e "s/^/$M: /" < /tmp/update-snapshots-ref.$$.$M
+ rm /tmp/update-snapshots-ref.$$.$M
+done
+
+all_ok="0"
+for M in $todo_machines; do
+ if [ ${results[$M]} = 0 ]; then
+ result="SUCCESS"
+ else
+ result="FAIL"
+ all_ok="1"
+ fi
+ echo "$result: $M"
+done
+
+exit $all_ok