Re: Xterm/Login hangs after starting remote service

From: Laurenz Albe (albe_at_culturallNOSPAM.com)
Date: 01/13/05


Date: Thu, 13 Jan 2005 09:28:36 +0000 (UTC)

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



Relevant Pages

  • Re: using IPC::Open3 to write to *and* read from a process...
    ... script an external binary at all. ... output on STDOUT or STDERR, and if I can write to the process on STDIN ... sub handle_sigchild ... in any case a filehandle knows if it's open or not. ...
    (comp.lang.perl.misc)
  • Re: Using subprocess module to launch a shell shell script that itself forks a process
    ... STDERR, the child will block waiting for the parent to read STDERR, ... process started by the shell script tries to read from STDIN. ... occurs because of the forked Java process, ...
    (comp.lang.python)
  • Re: Process.BeginErrorReadLine and BeginOutputReadLine; buffer not flushed?
    ... script, and redirects the stdout and stderr output from that script ... That means that if the process gets ahead of your reading process at all, the reading process can still wind up in a thread that's happy to keep reading the stream it's working on, while the OS buffers output sent to the other string. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: wife-proof way to launch ppp?
    ... enhanced text field, that doesn't really matter. ... You could settle on having her login shell ... You could even start X with a script from her ... Does that mac support running NetBSD? ...
    (comp.unix.bsd.freebsd.misc)
  • Open3 with nonblocking reads
    ... I'm currently trying to execute a script within a script, ... single line should contain if it's STDOUT or STDERR, ... STDOuts were passed to the logfile. ...
    (comp.lang.perl.misc)