[NTLUG:Discuss] How to suppress null message body report from mail
Patrick R. Michaud
pmichaud at pobox.com
Fri Jun 3 13:01:23 CDT 2005
On Fri, Jun 03, 2005 at 12:06:32PM -0500, Neil Aggarwal wrote:
> Patrick:
>
> This leads me to another question:
>
> Is there a way to change my script to not send an email if there
> is no content?
Oh sure, I almost sent that in my previous post but then decided
that probably wasn't what you wanted.... :-)
egrep $PATTERN $LOG >/tmp/log-excerpt
[ -s /tmp/log-excerpt ] && /bin/mail -s $SUBJECT $RECIPIENTS
Pm
> > -----Original Message-----
> > From: discuss-bounces at ntlug.org
> > [mailto:discuss-bounces at ntlug.org] On Behalf Of Patrick R. Michaud
> > Sent: Friday, June 03, 2005 8:13 AM
> > To: NTLUG Discussion List
> > Subject: Re: [NTLUG:Discuss] How to suppress null message
> > body report from mail
> >
> >
> > Neil Aggarwal wrote:
> >
> > >Null message body; hope that's ok
> > >
> > >Is there a way to suppress generating this message from
> > >mail? I have read the man page but I don't see anything
> > >that will help.
> >
> > Actually, rather than trying to prevent mail from generating the
> > message, can you just redirect it to an appropriate black hole?
> > Try changing your command line to
> >
> > cat $LOG | egrep $PATTERN | /bin/mail -s $SUBJECT
> > $RECIPIENTS >/dev/null
> >
> > Even better (the "cat" seems superfluous):
> >
> > egrep $PATTERN $LOG | /bin/mail -s $SUBJECT $RECIPIENTS >/dev/null
> >
> > With this, cron won't ever get any output from the mail command so
> > it won't send a cron report.
> >
> > Pm
>
>
> _______________________________________________
> https://ntlug.org/mailman/listinfo/discuss
More information about the Discuss
mailing list