LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 06-12-2008, 01:12 AM   #1
jtbinuya
LQ Newbie
 
Registered: Aug 2007
Posts: 11

Rep: Reputation: 0
I am unable to exit my script that uses ssh to login to a remote server


Good day,

I need help on resolving this issue. I wrote a script which logs to a remote server using ssh to run some commands. Upon exiting the remote server, the session just hangs. I can't even break (ctrl-c) the session. I tried adding zero (0) to the exit of the script but still it hangs. This happens after I run the java program on the remote machine. But if I just try to use the other options its fine, it exits with no problem.

Please help
 
Old 06-12-2008, 03:44 PM   #2
Ryzol
Member
 
Registered: Jun 2007
Distribution: Ubuntu, Slackware
Posts: 50

Rep: Reputation: 15
You could kill the session. "ps -e | less" shows a stack of all processes, so your session should be near the bottom. Killing either ssh or the shell running ssh should do the trick. If kill doesn't work try "kill -9". This is a kludge but it should end the hanging.
 
Old 06-12-2008, 10:17 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Java is really dumb, make sure EVERYTHING is closed. If that program is yours, make sure that it's not leaving any file descriptor open or something like that. Java programmers usually don't care at all about producing clean code because they think that's a task for the garbage collector. Ssh will not close the session if there's an open file descriptor that was open by a Java program running on the background.

EDIT: Just like this: http://marc.info/?l=secure-shell&m=117795193725629&w=2

Last edited by i92guboj; 06-12-2008 at 10:18 PM.
 
  


Reply



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
SSH : Takes a long time to login to a remote server TomCruise2002 Linux - Networking 8 12-04-2011 01:01 PM
auto-login script for connecting to remote m/n by using telnet/ftp/ssh Uday123 Programming 5 10-12-2011 11:31 AM
shell script for remote ssh login sefaklc Programming 5 08-28-2007 09:03 PM
SSH : Takes a long time to login to a remote server TomCruise2002 Linux - Enterprise 1 12-16-2005 06:58 PM
Remote server, unable to SSH anymore Keiser Linux - Newbie 1 05-06-2005 10:13 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration