I'm trying to ssh to 2 servers one by one and run the following command:
sudo node app.js
Here is my code:
#!/bin/bash
while read line; do
ssh -i "sshtest.pem" ec2-user@$line "sudo node app.js"
done < ips.txt
After sudo node app.js is executed the control doesn't pass over to the next ip in the loop. Can someone point me what I could do to improve this?