[colug-432] Where do cron jobs store their generated stdout while running?

Rob Stampfli res at colnet.cmhnet.org
Fri Feb 12 21:25:33 EST 2010


After doing a bit more investigating on this topic, I thought I'd
present the results of what I found to the group, although I found
nothing that was ultimately definitive.

When the Cron daemon is called upon to invoke the script, it spawns
a child CRON process, which sets up the proper environment and then
spawns both the script that is to be run and a copy of sendmail.
The stdout/stderr of the script goes into a pipe which is read by
the CRON child.  The CRON child also has another open write fd to
a separate pipe which goes to the sendmail's stdin.  None have any
other fds open to files that might possibly serve as a temporary
repository for the stdout of the script.

Several folks commented that the script output is being held in
the pipeline(s).  In previous Unixes, pipes had always been a
fixed size (one block of whatever size the underlying file system
used), and the pipe's reader would be able to retrieve the data
as soon it was written into the pipe from the other side.   Thus,
I doubt the data I want to see is stuck in the pipe itself.  The
size of the script's output is typically between 1 and 4 kB, so I
suppose it is possible the output could be cached in the stdio
buffers within the program.  (I don't know what the stdio buffer
size is on this machine, but on other Unixes I've dealt with, it
has typically been 512 bytes.)

In any event, I'm setting this investigation aside for the time
being.  If I ever figure out what's going on -- perhaps pull the
source to Linux Cron and study it -- I'll let you know.

Thanks to all who offered suggestions.

Rob


More information about the colug-432 mailing list