#!/bin/bash
echo -e command template as follow: "\n sh ~/sh/dist_batch_exec.sh [--background] \"date\""<<EOF
EOF
if [[ ! -f ~/sh/node.cfg ]]; then
echo
echo Error: ~/shell/node.cfg must be set
echo -e node config template as follow: "\nslave1\nslave2"<<EOF
EOF
exit
else
echo need run node:
echo `cat ~/sh/node.cfg`
fi
echo "=================start run================"
if [[ $1 = '--background' ]]; then
shift
for i in `cat ~/sh/node.cfg`; do
echo current node $i:
ssh -oStrictHostKeyChecking=no -n $i "$@" &
done
else
for i in `cat ~/sh/node.cfg`; do
echo current node $i:
ssh -oStrictHostKeyChecking=no $i "$@"
done
fi
wait
echo "=================end run================"