[CentOS] This "find" command

Rodrigo Barbosa rodrigob at suespammers.org
Sun Dec 25 02:06:49 UTC 2005


-----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.

[]s

- -- 
Rodrigo Barbosa <rodrigob at suespammers.org>
"Quid quid Latine dictum sit, altum viditur"
"Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDrf64pdyWzQ5b5ckRAuHbAJkBTw0AMYXRvafnoXdkt4XmawXcdACdGIst
zMezfdBk2VnwhBQpzpJmK50=
=zIME
-----END PGP SIGNATURE-----



More information about the CentOS mailing list