I need a script to change server automatically after performing some operations.
The command for changing server is ssh username@servername . Then a prompt comes to enter a password. Then i need to perform some opertaions on the other server. How can i do this in a script?
an example:
#!/bin/bash
ServerList="server1 server2 server3"
ScriptsPath=../Scriptpath/..
for Server in $ServerList
do
{
ssh -qt username@$Server $ScriptsPath/ScriptName.sh }
done