#!/bin/bash
for id in {2..9}
do
cnode=`printf "cnode%.2d" $id`
echo ""
echo "----------------- $cnode -------------------"
ssh root@"$cnode" $@
done
사용법
./allcmd.sh "ps aux|grep abc"
#!/bin/bash
if [ $# == 3 ]; then
start=$2
end=$3
fi
s=${start-1}
e=${end-28}
for (( id=$s; id<=$e; id++ ))
#for id in {1..28}
do
cnode=`printf "cnode-%.2d" $id`
echo ""
echo "----------------- $cnode -------------------"
ssh root@"$cnode" $1
done
사용법
./allcmd2.sh "hostname" 3 10
3번부터 10번 노드만 검증