Hi ,
I have to write a shell script to telnet to specific host and execute the admin command there. Please help me to do that.
Eg : telnet hostname portno
admin command
exit
Hi ,
I have to write a shell script to telnet to specific host and execute the admin command there. Please help me to do that.
Eg : telnet hostname portno
admin command
exit
Do you mean to execute command on telnet prompt?
You generally do it with heredoc.
telnet host port << END
LOGIN:USER:PASS
OTHER TELNET COMMANDS
quit
END
The specific host is the admin box... I have to run the script from after telneting..
Ok. So you want to execute shell commands right?
Try..
( sleep 3
echo ${LOGIN}
sleep 2
echo ${PSWD}
sleep 2
echo "/usr/bin/ksh /some/script.ksh"
sleep 5
echo "exit" ) | telnet ${HOST}
You can skip/decrease "sleeps" but sometimes those are really helpful to save you.