NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: help with an audit-packages shell script



> I want a shell script that I can cron.  I want this script to do an
> audit-packages and send me an email if there is anything that needs
> patching.  The script below works, except that it sends the email even
> if audit-packages returns nothing.
> 
> Can anyone improve it?  the last two lines should be one line
> thanks, Philip
> 
> 
> #!/bin/sh
> /usr/pkg/sbin/download-vulnerability-list

cron will send email from that also. Maybe >/dev/null 2>&1

But then you will lose real errors. Old versions of 
download-vulnerability-list have a -q quiet switch. I don't know what 
happened to that.

> /usr/pkg/sbin/audit-packages > /root/auditpackages.txt

if test -s /root/auditpackages.txt ; then

> (echo "Subject: Audit Packages Output";cat
> /root/auditpackages.txt)|/usr/sbin/sendmail me%example.com@localhost

fi


(Just using /etc/security.local is a good idea too.)


Home | Main Index | Thread Index | Old Index