view master/bin/pbash.sh @ 54:1099246f22b6

new scripts
author Henry S. Thompson <ht@markup.co.uk>
date Fri, 08 Feb 2019 17:46:49 +0000
parents
children
line wrap: on
line source

#!/bin/bash
if [ $# -lt 1 ]
then
  cat 1>&2 <<EOF
Usage: $0 [-h sshHostFile] cmd [...args]
Where SSname is the name of a VM scale set.
sshHostFile (defaults to $WORKERS) is the name of a file in
 .parallel which lists hosts and ports, see man parallel for details

Runs cmds/cmdlines on every machine in a scale set,
 using parallel --nonall

cmd+args can be quoted to run over multiple lines

Use xargs $0... to get multiple args from stdin, e.g.
> xargs $0 W4 echo
hello
world
^D
hello world
hello world
...

Do 
 > echo 'will cite' | parallel --citation 2>/dev/null
to turn off citation prompt
EOF
 exit 1
fi
if [ $1 = -h ]
then
 shift
 shf="$1"
 shift
else
 shf=$WORKERS
fi
parallel --sshloginfile $shf --nonall "$@"