Unix Technical Forum

Xterm/Login hangs after starting remote service

This is a discussion on Xterm/Login hangs after starting remote service within the Linux Operating System forums, part of the Unix Operating Systems category; --> Hi, I`m loggin into a remote site via ssh from an existing login shell. Then I start a program ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-18-2008, 07:20 AM
fritz-bayer@web.de
 
Posts: n/a
Default Xterm/Login hangs after starting remote service

Hi,

I`m loggin into a remote site via ssh from an existing login shell.
Then I start a program using a start script.

The script contains the following start line to run the program:

nohup /opt/java/bin/java -jar httpd.jar localhost:80 2>&1 >>
standard_input_output.log &
This works - the program starts up. However, when I logout my xterm
window hangs and I do not get back to the login shell from before.

I then have to kill the xterm session completely. Why does this
behavious occurr?

I have noticed that this happens always, if your program writes to
standard output and does not redirect the output to a file - but that's
what I'm doing.

Why does my xterm session get stuck?
BTW: Am I using if and when correctly in here?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-18-2008, 07:20 AM
Laurenz Albe
 
Posts: n/a
Default Re: Xterm/Login hangs after starting remote service

fritz-bayer@web.de wrote:
> I`m loggin into a remote site via ssh from an existing login shell.
> Then I start a program using a start script.
>
> The script contains the following start line to run the program:
>
> nohup /opt/java/bin/java -jar httpd.jar localhost:80 2>&1 >>
> standard_input_output.log &
> This works - the program starts up. However, when I logout my xterm
> window hangs and I do not get back to the login shell from before.


What you do is the following (in symbolic notation):
stderr = stdout;
stdout = fopen("standard_input_output.log", "a");

After these two operations stderr still points to the original stdout,
so your stderr writes to the terminal, resulting in the observed behaviour.

The solution is to reverse the redirections:

nohup /opt/java/bin/java -jar httpd.jar localhost:80 \
>>standard_input_output.log 2>&1 &


Yours,
Laurenz Albe
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-18-2008, 07:20 AM
fritz-bayer@web.de
 
Posts: n/a
Default Re: Xterm/Login hangs after starting remote service


Laurenz Albe wrote:
> fritz-bayer@web.de wrote:
> > I`m loggin into a remote site via ssh from an existing login shell.
> > Then I start a program using a start script.
> >
> > The script contains the following start line to run the program:
> >
> > nohup /opt/java/bin/java -jar httpd.jar localhost:80 2>&1 >>
> > standard_input_output.log &
> > This works - the program starts up. However, when I logout my xterm
> > window hangs and I do not get back to the login shell from before.

>
> What you do is the following (in symbolic notation):
> stderr = stdout;
> stdout = fopen("standard_input_output.log", "a");
>
> After these two operations stderr still points to the original

stdout,
> so your stderr writes to the terminal, resulting in the observed

behaviour.
>
> The solution is to reverse the redirections:
>
> nohup /opt/java/bin/java -jar httpd.jar localhost:80 \
> >>standard_input_output.log 2>&1 &

>
> Yours,
> Laurenz Albe



Thanks that made it work!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:59 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com