[CentOS] This "find" command

rado rado at rivers-bend.com
Sun Dec 25 22:36:32 UTC 2005


On Sun, 2005-12-25 at 00:06 -0200, Rodrigo Barbosa wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Sat, Dec 24, 2005 at 10:49:25AM -0600, rado wrote:
> > find is giving me fits!
> > 
> > this command is really the heart of a backup script I am trying to get
> > going.
> > 
> > here's the line:
> > 
> > if find / -mtime -1 -type f | xargs clamscan -
> > l /var/log/clamav/clamscan-bu-daily.log $clamexcludes -r --no-summary |
> > cut -d: -f1 > /usr/local/bin/changedfilelog; then
> > 
> > and the clamexcludes:
> > clamexcludes="--exclude=/sys/bus/pci/drivers --exclude=/proc --
> > exclude=/sys/class/scsi_host --exclude=/usr/share/doc/clamav-0.87 --
> > exclude=/usr/lib/mailman/tests/msgs "
> > 
> > kk ...when it's all over...I have to have /var/log/clamav/clamscan-bu-
> > daily.log to be w/out FOUND or ERROR words anywhere. if either of these
> > words are in that file, the system will not back up but instead, email
> > me.
> > 
> > the immediate problem is...no matter what I try, the find command does
> > not perform as I want.
> > 
> > the file seems to load up like 280,000 files which seems like the total
> > system etc.
> 
> There are actually easier ways to do it, you know. You can first
> run clanscan, then check the logfile with either grep or sed to make
> sure it is what you want it to be, and based on that result decide 
> what to do with an if statement.
> 
> Something like this:
> 
> find / -mtime -1 -type f --exec clanscan -l \
> 	/var/log/camav/clanscan-bu-daily.log \
> 	$clanexcludes -r --no-summary "{}" \; | \
> 	cut -d: -f1 > /usr/local/bin/changedfilelog
> NOTOK=`cat /var/log/clamav/clamscan-bu-daily.log | sed -n -e '/FOUND/p;/ERROR/p'`
> 
> if [ "${NOTOK}" != "" ]; then
> 	....
> 
> I can't actually test this here, since I don't use clanscan, but it is
> supposed to do what you want.

Rodrigo, thx for this! ...Christmas and all that's goin on...hopefully
tonite or tomorrow nite I can get back and try your ideas of this...thx
for them!

John Rose




More information about the CentOS mailing list