Help translating Linux a find command statement to FreeBSD 7.2

I'm attempting to deploy a script to scan for changed files and scan them. This is a Linux script that I've been trying to get to work and searched here and around the web. I get syntax errors using the [CMD="find"] -wholename[/CMD] right out of the gate with 7.2. How can I change this to work with FreeBSD 7.2?

Code:
#!/usr/local/bin/bash

# Log location
LOG=/var/log/clamav/scan.log
# .....
find / -not -wholename '/sys/*' -and -not -wholename '/proc/*' -mmin -61 -type f -print0 | xargs -0 -r clamscan --exclude-dir=/proc/ --exclude-dir=/sys/ --quiet --infected --log=${LOG}

Thanks!
 
wblock@ said:
Old versions of FreeBSD find(1) do not have the -wholename option. Later ones, like in 8.x, add that as a synonym for -path
Yes, that's why I'm asking here. I'm sure things would be easier if I were working with a newer version of FreeBSD.

wblock@ said:
Was the dash on -61 intentional?
It is the unmodified code that works on Linux. It means modified or created less than 61 minutes ago.

Thanks!
 
-wholename seems to be the same thing as -path. From my CentOS 5 manpage:
Code:
       -path pattern
              See -wholename.   The predicate -path is also  supported  by  HP-UX
              find.

And from my FreeBSD 9 manpage:
Code:
     -wholename pattern
       The same thing as -path, for GNU find compatibility.


And a free complimentary example for verification:
Code:
[~/test]% find .
.
./dir1
./dir1/asdasd
./dir2
./dir2/afasf

[~/test]% find . -not -path './dir1*'
.
./dir2
./dir2/afasf
 
Carpetsmoker said:
-wholename seems to be the same thing as -path.
It is, it's a synonym added for GNU compatibility. If you don't have wholename, you don't have path.

What I did do is write two nice, portable scripts, one for scanning with ClamAV daily that does the entire server, and another for scanning for a user definable modification date period, say hourly, and where you can easily change which directories you want scanned without touching the code.

Thanks!
 
IT_Architect said:
It is the unmodified code that works on Linux. It means modified or created less than 61 minutes ago.
That works with FreeBSD as well:
  • % find . -mmin 61 means exactly 61 minutes ago.
  • % find . -mmin [b]-[/b]61 means less than 61 minutes ago.
  • % find . -mmin [b]+[/b]61 means more than 61 minutes ago.
 
Carpetsmoker said:
WOW! I looked for that, and it was hidden in plain site. That makes me wrong about if wholename is not available, neither is path available". Not true as evidenced in the FreeBSD manual. The thing is, when I used -path, it comes back with invalid option errors.
Edit: Man do I have to eat crow on this one! I took the stock script and simply substituted -path for -wholename, and it worked perfectly! Oh duh!

Thanks TONS!
fonz said:
That works with FreeBSD as well
I was asked that question and explained to someone else further up the thread. I do use that.

Thanks!
 
Back
Top