LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-01-2010, 09:24 AM   #1
CQ1ST
Member
 
Registered: Oct 2005
Location: NewZealand
Distribution: Crunchbang, Slitaz, Puppy
Posts: 70

Rep: Reputation: 17
telnet to reset modem > can't close


Code:
#!/usr/bin/expect -f
spawn telnet 10.1.1.1
expect -re "login"
send "username\n"
expect -re "Password"
send "password\n"
expect #
send "reboot && sleep 70 && exit\n"
interact
reboot works great, but then I'm stuck in an unresponsive telnet session (&& sleep 70 && exit) does not work

how could I exit this?
 
Old 01-01-2010, 09:33 AM   #2
carltm
Member
 
Registered: Jan 2007
Location: Canton, MI
Distribution: CentOS, SuSE, Red Hat, Debian, etc.
Posts: 697

Rep: Reputation: 93
The easy way is to remove the "&& sleep 70". The problem is that you
must disconnect before the telnet session is killed, which is less than
70 seconds. If you really want to stay connected, just reduce the number
of seconds before you run exit.
 
Old 01-01-2010, 08:32 PM   #3
CQ1ST
Member
 
Registered: Oct 2005
Location: NewZealand
Distribution: Crunchbang, Slitaz, Puppy
Posts: 70

Original Poster
Rep: Reputation: 17
yeah, I've got it to work - a bit tricky because of the reboot/lost connection

Code:
#!/usr/bin/expect -f
spawn telnet 10.1.1.1
expect -re "login"
send "username\n"
expect -re "Password"
send "password\n"
expect #
send "reboot && quit\n"
expect #
send "exit\n"
interact
finally does it perfectly
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't end telnet servcie in xinetd when close remote telnet cliend forcely zeroneworld Linux - Newbie 2 12-09-2007 09:47 PM
Can't end telnet servcie in xinetd when close remote telnet cliend forcefully. zeroneworld Linux - General 1 12-06-2007 08:17 AM
HLDS closes when I close telnet MarleyGPN Linux - General 1 04-26-2003 06:34 PM
How to Close telnet using ipchains xtian500 Linux - Security 1 02-19-2002 04:50 AM


All times are GMT -5. The time now is 11:43 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration