[clue] tee in cronjob

David L. Anselmi anselmi at anselmi.us
Mon May 19 18:07:29 MDT 2014


Quentin Hartman wrote:
>
> Interestingly, all of the "tee" output seems to be buffered until cron
> kills the script or the script dies for some other reason.

So you mean the stdout data that cron emails you?

So (for Vixie cron anyway) "any  output  is  mailed  to  the  owner".  You'd expect that to be one 
email, right?  Not one per line or some other subset.  So the mail can't be sent until the script ends.

The behavior you see is because your script runs for a really long time.  I don't think the while 
has anything to do with it.  Does that make sense?

If you want more mail, the answer is to send mail yourself.

If you want mail for each error you break the loop, send the mail, and go back to looping again.

If you want mail for each loop, you send the mail as part of your commands.

Or, if you know you're running every minute (or 5, or ...), take out the loop and schedule the cron 
appropriately.  And only produce output for cases where you want a mail.

Dave


More information about the clue mailing list