diff options
Diffstat (limited to 'tcwg-rsync-dir.sh')
-rwxr-xr-x | tcwg-rsync-dir.sh | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/tcwg-rsync-dir.sh b/tcwg-rsync-dir.sh deleted file mode 100755 index 56372616..00000000 --- a/tcwg-rsync-dir.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -snapshots_dir= -verbose=false - -OPTS="`getopt -l dir:,verbose: -- "$@"`" -while test $# -gt 0; do - case $1 in - --dir) snapshots_dir="$2"; shift ;; - --verbose) verbose="$2"; shift ;; - --) shift; break ;; - esac - shift -done - -if $verbose; then - verbose="set -x" -else - verbose="" -fi -$verbose - -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 - ( - $verbose - 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 - echo "Waiting completion for $M..." - 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="FAILED" - all_ok="1" - fi - echo "$result: $M" -done - -exit $all_ok |