i want to login (telnet) to 2 different servers. Then I will execute command in those servers as many time as I need(i will choose the server to execute the command). Is it possible?
i.e, my script will be stayed log on two servers (server1, server2). Then I will execute command by choosing one server at a time. It will take input from the terminal and decide from which the command has to be executed. I wanna to avoid login every time I need to execute command.
it may be bash, perl or others. i can log on using expect script. please help me
And use a case statement to select the server depending on what command you have selected if the command is to be a parameter to your script then that line needs to be:
COMMAND="$@"
if [ -z "${COMMAND}" ]; then
echo "ERROR: No command given as parameter, aborting!"
exit 99
fi
.
Either that or look into using /etc/hosts.equiv on the server but telnet and hosts.equiv are insecure.
Thanks TonyFullerMalv
I can use either ssh or telnet. It is not the problem. I do not want to log on every time I execute the command. Main thing is that I will be stayed log on to two servers from a single script and It will execute my desired command to desired server taking input of the shell.
Is it possible by using subshell? i'm not clear about subshell.