[CentOS] This "find" command

Robert kerplop at sbcglobal.net
Sun Dec 25 02:43:28 UTC 2005


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.
>
>[]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-----
>_______________________________________________
>CentOS mailing list
>CentOS at centos.org
>http://lists.centos.org/mailman/listinfo/centos
>
>  
>
Speaking of the 'find' command, I believe I found an inconsistency just 
a few hours ago. In "man find", it states that when testing by size, the 
suffixes b, c, w, k, M and G are valid. However, the texinfo document 
makes no mention of the 'M' or 'G' suffixes. The command appears to work 
like the info file says.
[rj at mavis download]$ find ~ -depth -type f -size +600M -print
find: invalid -size type `M'
[rj at mavis download]$
Using a size test "-size +600000k" instead works fine.

This is with CentOS 4.2, fully updated.
[rj at mavis download]$ rpm -q findutils
findutils-4.1.20-7



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20051224/02639099/attachment.html>


More information about the CentOS mailing list