I have a problem with auto telnet script, but I want to tell u something
a) I am only a member access on the server, so not able to access 'root' account
b) not able to install any software on server
3) On server, there is not install 'except'
I have to write a script, which is ran from A server, login/telnet to B server, do 'ls -lrt' and send to me the output via mail.
I have only basic stucture....
run from Server A
1) login to B
2) cd landing path
3) ls -l > a.txt
4) mail -s "Status" firstname.lastname@example.org < a.txt
5) connection closed
I tried this code.....
run from Server A
ls -l > a.txt
mail -s "Status" email@example.com < a.txt
) | telnet B
But this script return the ls of Server A but I want the Server B
guys please help me...
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
1 reply Latest Post - 2011-06-01T22:39:17Z by SystemAdmin
Pinned topic How to auto telnet the server from another server?
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2011-06-01T22:39:17Z at 2011-06-01T22:39:17Z by SystemAdmin
SystemAdmin 110000D4XK549 PostsACCEPTED ANSWER
Re: How to auto telnet the server from another server?2011-06-01T22:39:17Z in response to Atul.SinghHi Atul,
There are Several ways to achieve this.
#1. This can be achieved directly using ssh command as
ssh firstname.lastname@example.org <command>
#2. As you have mentioned you have only telnet login method to
B. Assuming that you have expect S/w installed in A
spawn telnet <machinename>
send "ls -l > fileName"
send "mail -x ..."
will do the Magic ...
There are other ways too....