54
|
1 #!/bin/bash
|
|
2 if [ $# -lt 1 ]
|
|
3 then
|
|
4 cat 1>&2 <<EOF
|
|
5 Usage: $0 [-h sshHostFile] cmd [...args]
|
|
6 Where SSname is the name of a VM scale set.
|
|
7 sshHostFile (defaults to $WORKERS) is the name of a file in
|
|
8 .parallel which lists hosts and ports, see man parallel for details
|
|
9
|
|
10 Runs cmds/cmdlines on every machine in a scale set,
|
|
11 using parallel --nonall
|
|
12
|
|
13 cmd+args can be quoted to run over multiple lines
|
|
14
|
|
15 Use xargs $0... to get multiple args from stdin, e.g.
|
|
16 > xargs $0 W4 echo
|
|
17 hello
|
|
18 world
|
|
19 ^D
|
|
20 hello world
|
|
21 hello world
|
|
22 ...
|
|
23
|
|
24 Do
|
|
25 > echo 'will cite' | parallel --citation 2>/dev/null
|
|
26 to turn off citation prompt
|
|
27 EOF
|
|
28 exit 1
|
|
29 fi
|
|
30 if [ $1 = -h ]
|
|
31 then
|
|
32 shift
|
|
33 shf="$1"
|
|
34 shift
|
|
35 else
|
|
36 shf=$WORKERS
|
|
37 fi
|
|
38 parallel --sshloginfile $shf --nonall "$@"
|
|
39
|
|
40
|
|
41
|