-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy.sh
executable file
·55 lines (46 loc) · 930 Bytes
/
copy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
checkerrors () { # {{{
$BASECMD -t 20 -o out/ls/ ssh $slice@{} ls
ls $basedir | sort > base.txt
echo "# reporting copy errors:"
for file in $( ls out/ls/*.out ) ; do
cat $file | sort > tmp
if ! diff tmp base.txt > /dev/null ; then
name=$(basename $file)
echo ${name%.out}
fi
done
rm tmp base.txt
} # }}}
usage () { # {{{
cat <<-USAGE
usage: $0 -i NODELIST -l SLICE -d BASEDIR
BASEDIR will be copied into every node in NODELIST using SLICE.
USAGE
exit 1
} # }}}
nodelist=invalid
slice=invalid
basedir=invalid
while getopts "i:l:d:h" OPTNAME ; do # {{{
case $OPTNAME in
i)
nodelist=$OPTARG
;;
l)
slice=$OPTARG
;;
d)
basedir=$OPTARG
;;
h|*)
usage
;;
esac
done # }}}
test $nodelist != invalid || usage
test $slice != invalid || usage
test $basedir != invalid || usage
BASECMD="vxargs -pr -a $nodelist -y"
$BASECMD -t 300 -o out/copy/ scp -rqC $basedir/* $slice@{}:
checkerrors