Index: [Article Count Order] [Thread]

Date:  Fri, 11 Aug 2006 14:10:08 -0700
From:  Bruce Timberlake <brucetimberlake (at mark) gmail.com>
Subject:  [coba-e:06331] Re: Request CRON command
To:  coba-e (at mark) bluequartz.org
Message-Id:  <44DCF230.2000504 (at mark) gmail.com>
In-Reply-To:  <005e01c6bd83$ccfbd760$6400a8c0@COMPUTER8SD7ER2>
References:  <005e01c6bd83$ccfbd760$6400a8c0@COMPUTER8SD7ER2>
X-Mail-Count: 06331

> Actually, I have figured out how to do this.  I put a file in cron.d:
> 
> 00 2 * * *      root    (diff maillist maillist.bak | mail -s "Daily
> majordomo output from BQ Server" admin (at mark) domain.com | cp -f maillist
> maillist.bak)
> 
> This works great, with one exception: if there is no diff output, the
> command will send a blank email message to admin (at mark) domain.com.  What should I
> do to avoid sending a message if the diff results are null?

If you just execute a cronjob, and don't pipe it through the mail 
command, it automatically sends an email if any output is generated, 
and will remain silent if there is no output (the mail captures 
anything that would be sent to an interactive shell session if you 
issued the same command).

Cron automatically sends the emails to root (at mark)  though, not admin (at mark) . But I 
think everything to root is auto-forwarded to admin anyway...