Re: Question about nohup
From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 03/13/04
- Previous message: John: "Sparc5 Sol 8 Apache 2.0.48 ?"
- In reply to:(deleted message) Madhusudan Singh: "Question about nohup"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 13 Mar 2004 14:34:17 -0500
In article <c2ufp7$22819u$1@ID-159130.news.uni-berlin.de>,
Madhusudan Singh <spammers-go-here@yahoo.com> wrote:
> Hi
>
> I regularly use nohup to start computation intensive jobs on remote
> Sun
> machines. Usually this creates a file named "nohup.out" in the working
> directory that contains the o/p that would have occured on the terminal had
> the program been run without nohup.
>
>
> I have noticed that sometimes, upon completion of the process, the
> file
> nohup.out does not contain anything. There is plenty of space on the disk,
> but it would not form. Now, I have seen this behaviour before, but ignored
> it as it did not matter. Lately, a few processes of mine have been crashing
> mysteriously and I do need to see at which point the process crashed.
> Absent nohup.out, there does not seem to be a way.
If the program uses stdio, it defaults to full buffering of stdout
whenever it's connected to something other than a terminal. If the
program crashes before it has produced enough output to fill the buffer
(which I think tends to be about 4KB on many systems), the buffer will
not be flushed to the file.
>
> I have looked at the man page, and there do not seem to be any
> options that
> would force nohup to dump the console o/p from whatever it was running. Is
> redirecting terminal o/p to another file, the only way to get the
> information ? (like nohup process 2>processlog.txt & ) ?
If my assumption above is correct, the problem is with stdout, not
stderr. By default, stderr is unbuffered, so it doesn't suffer from the
problem I described. Your command here redirects stderr, not stdout.
Anyway, doing the redirection explicitly doesn't change the problem --
it's still going to a file instead of a terminal, so it's still going to
be buffered.
The Expect scripting language comes with an "unbuffer" script that makes
use of a pseudo-tty to prevent this buffering. Or if you can modify the
program's source code, you can use setbuf() to disable buffering of
stdout.
-- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
- Previous message: John: "Sparc5 Sol 8 Apache 2.0.48 ?"
- In reply to:(deleted message) Madhusudan Singh: "Question about nohup"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|