On Sun, May 08, 2005 at 07:14:47PM +0100, Matt Fretwell said:
> Timothy Omer wrote:
> 
> > I apologies for my ignorance, I am still new to Linux.
> > 
> > How would I get cron to email me only when a virus is found, I will need
> > it to send the email to my external email account.
> 
> 
>  The -i flag only shows infected files. Cron only sends a mail if the
> command generates output. If there are no infected files, no output, hence
> no notification.
> 
> clamscan --no-summary -i -r /path/to/dir
> 
>  For sending to your external account, either alias the crontab owner to
> your external mail address, or put something along the lines of the
> command below in cron, or in a shell script which cron runs.
> 
> clamscan --no-summary -i -r /path/to/dir ||
>    mail -s 'virus found' [EMAIL PROTECTED]
> 
>  man 5 crontab. It will explain the specifics of crontabs.

Setting the environment variable MAILTO in the crontab is a more
effective (although less portable) way to do this.
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | Parts that positively cannot be         |
|  [EMAIL PROTECTED]             | assembled in improper order will be.    |
|  http://www.lobefin.net/~steve |                                         |
 --------------------------------------------------------------------------

Attachment: pgpKpFOluDz0r.pgp
Description: PGP signature

_______________________________________________
http://lurker.clamav.net/list/clamav-users.html

Reply via email to