I am pretty new to linux so forgive me for asking a basic question
I am using SSH to control 40 machines. What i am trying to do is remotely bash a shell script on each machine. I am using a for loop to bash every script, code as follows.
code in host machine runallworkers.sh:
...
i=1
for each $ip[] in ip[] #just for example, i have saved all ips in a array ip[]
do
SSH -i aaa.rsa ubuntu@${ip[]} 'bash /home/ubuntu/program/runworker.sh'
echo "running worker in node $i"
let i++
done
...
code in each runworker.sh in each worker machine:
./worker.pl 7000 &
#worker.pl is a socket server program. it takes the parameter 7000 to run. it listens to port 7000
i can manually bash the runworker.sh file in each worker machine. So the worker.pl file should work fine. I can use the for loop to do other stuff on each node, so the loop should work fine too.
But the problem occurs when i run the script in the host machine, it stop responding after the first bashing, so the loop can not go on... the screen shows something like this:
ubuntu@1.1.1.1:~$ bash runallworkers.sh
running worker in node 1
please someone help me out...
Thanks in advance!!