Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Sanity check: Tiny wrapper script for /bin/mail

by Bloodnok (Vicar)
on Nov 29, 2013 at 17:21 UTC ( [id://1064992]=note: print w/replies, xml ) Need Help??


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

Assuming that CRON_macscanner behaves POSIXly, would something like the following not do what you want? ...
05 12 * * * root /home/atlas/tools/CRON_macscanner >/tmp/CRON_macscann +er 2>&1 || mail -s "[Nettverk][Error] CRON_macscanner" email@address. +here < /tmp/CRON_macscanner
As per usual, just a thought :-)

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

Replies are listed 'Best First'.
Re^2: Sanity check: Tiny wrapper script for /bin/mail
by FloydATC (Deacon) on Nov 30, 2013 at 11:25 UTC

    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

      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 :-))

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1064992]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-24 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found