Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Mar 1999 21:19:31 +1000
From:      Greg Black <gjb@comkey.com.au>
To:        Roelof Osinga <roelof@eboa.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Phantom mail in local queue 
Message-ID:  <19990330111931.25874.qmail@alpha.comkey.com.au>
In-Reply-To: <36FFD62D.8E9B5D39@eboa.com>  of Mon, 29 Mar 1999 21:36:13 %2B0200
References:  <36FC34A6.666D756A@eboa.com> <19990327053803.7854.qmail@alpha.comkey.com.au> <36FFD62D.8E9B5D39@eboa.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> So I guess the cron job first creates half a mail, then goes checking
> to see if it can find half completed mails and finally reports that
> it does indeed, then closes the mail thereby taking care of the problem
> it reported? Not what I expected <g>

The way you've summarised this makes the system sound silly. But
that's not the way it really happens because there are two
completely independent processes involved in this.

When cron runs any job, it normally collects anything that the
job writes to its standard output and standard error streams and
mails that output to the job's owner (see the man pages for the
full story on this).  So, since the daily scripts might produce
output, cron sets up a mail process to handle the output.

Unknown to cron, and of no consequence to it, the daily script
runs the mailq command, not to disclose the incomplete mail job
that will ultimately send the daily script's output to root, but
to determine if there are real mail jobs queued and not getting
anywhere.  Of course, since there is a mail job that is at that
moment incomplete, it appears in the queue in the form that you
have seen.  This is not a problem; it's just a fact.

Once the cron job completes, the balance of its output is then
collected and mailed and so the mail job disappears from the
queue.  All this is an artifact of the way the daily (and other)
scripts work -- they just write stuff to their standard output,
so that an interactive user will see what's happening; this is a
convenient approach because, when the scripts are run by cron,
the same output is collected automatically and mailed to the job
owner.  No fuss.  Except for that one unfinished mail job, and
nobody is ever going to waste their time eliminating that from
the output.

-- 
Greg Black <gjb@acm.org>



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990330111931.25874.qmail>