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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? |
| |||
| 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 |
| ||||
| 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! |