in reply to Re: Sanity check: Tiny wrapper script for /bin/mail
in thread Sanity check: Tiny wrapper script for /bin/mail

I don't think a single one of those cron scripts return proper exit codes since they were originally meant to produce text output if problems were detected and otherwise just be quiet. But if they did then I suppose this solution would work. As a bonus, this approach would leave traces in /tmp which could be useful for summarizing. Hmm.

-- FloydATC

Time flies when you don't know what you're doing

  • Comment on Re^2: Sanity check: Tiny wrapper script for /bin/mail

Replies are listed 'Best First'.
Re^3: Sanity check: Tiny wrapper script for /bin/mail
by Bloodnok (Vicar) on Dec 02, 2013 at 09:14 UTC
    In which case, this might be slightly more effective...
    05 12 * * * root /home/atlas/tools/CRON_macscanner >/tmp/CRON_macscann +er 2>&1; test -s /tmp/CRON_macscanner && mail -s "[Nettverk][Error] C +RON_macscanner" email@address.here < /tmp/CRON_macscanner

    Be very wary of leaving/using traces in /tmp - on most OS'es, this gets emptied at shutdown &/or startup. If you definitely want records, then I'd suggest creating & using a subdirectory of /var/log.

    A user level that continues to overstate my experience :-))