Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Telnet Log

Status
Not open for further replies.

mediation

Technical User
Nov 11, 2006
17
Dear All,

I have a telnet script and i want to make a telnet session log to save all results in a file when i excute the script.

Thanks and Bregards.
 
Can you elaborate, please? What exactly does your 'telnet script' do?

Alan Bennett said:
I don't mind people who aren't what they seem. I just wish they'd make their mind up.
 
How bout this ... I use this all the time ... real nice when I have to visit a few boxes and make a small change.

#! /bin/ksh
#
DOIT () {
echo "<login>"
sleep 1
echo "<password>"
echo "en"
sleep 1
echo "<2nd lvl passwd>"
sleep 1
echo "config t"
echo "hostname sumguyscheapscript"
echo "wr mem"
sleep 6
echo "copy run start"
echo "\n"
sleep 2
echo "disable"
echo "exit"
}
#
while read x
do
DOIT | telnet $x | tee $x.log
done

ps .. I do a wr m and copy run start so that I dont have to figure out which box supports or doesnt support wr m.

This is works great for routers. You can use interact as the last statement if you just want to run commands.

Regards
Sumncguy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top