未验证 提交 163f568f 编写于 作者: J Jeff Rasley 提交者: GitHub

allow passing hostfile to ds_ssh (#1504)

上级 ee6a92c0
......@@ -10,11 +10,25 @@ fi
hostfile=/job/hostfile
while getopts "h?f:" opt; do
case "$opt" in
h|\?)
echo "-f <hostfile>: specify a hostfile, defaults to /job/hostfile"
exit 0
;;
f)
hostfile=$OPTARG
shift $((OPTIND-1))
;;
esac
done
echo "hostfile=$hostfile"
if [ -f $hostfile ]; then
hosts=`cat $hostfile | awk '{print $1}' | paste -sd "," -`
export PDSH_RCMD_TYPE=ssh
pdsh -w ${hosts} $@
else
echo "Missing hostfile at ${hostfile}, executing command locally"
$@
echo "Missing hostfile at ${hostfile}, unable to proceed"
fi
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册