I have 3 ec2 machines, and on each machines I have to run some server. So I am trying to create a bash script to accomplish the task. sample script
ssh -t ubuntu@server1 << EOL
start server1
EOL
ssh ubuntu@server2 << EOL
start server2
EOL
ssh ubuntu@server3 << EOL
start server3
EOL
Now the problem is that after my script encounters the start Server1
command, it gets stuck there, as it is running a server, so it is pretty obvious.
I want to make sure that the whole script runs, i.e. server 1 and server 2 get started successfully, and I only see the server3 command output on my local machine's terminal.
Can anyone please give me a script, which will suffice my needs? I am a complete bash script noob. Kindly help