wood burning stoves*
The moose likes Linux / UNIX and the fly likes Need to exit from telnet after connecting via shell script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Need to exit from telnet after connecting via shell script" Watch "Need to exit from telnet after connecting via shell script" New topic
Author

Need to exit from telnet after connecting via shell script

Binesh Veetil
Greenhorn

Joined: Jan 21, 2012
Posts: 9
Hi,

I am doing a telnet to a remote IP via a shell script. Is there a cmd in shellscript wherein I can exit from telnet session and also is there a way to set the timeout?

Thanks,
BV
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15952
    
  19

Setting the user timeout in Linux is a bit tricky. I'd have to google for details myself.

The exit from telnet is simple, though. It's simply end-of-file. If you're running a telnet session from a script, the end of the stdin stream will disconnect. For interactive sessions, type Ctrl-D, just as you would to logout.

Customer surveys are for companies who didn't pay proper attention to begin with.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Need to exit from telnet after connecting via shell script
 
Similar Threads
Output of telnet task
Current directory not in path when logging via ssh
URGENT !! How can a shell script get the System.exit() exit value?
sftp
Runtime.getRuntime().exec() from JSP page