root crontab bug? (Undocumented find -mount option)
Joe Smith
jms at tardis.tymnet.com
Thu Jun 6 00:17:00 AEST 1991
In article <2802 at brchh104.bnr.ca> ray at kea.am.dsir.govt.nz (Ray Brownrigg) writes:
: What is this leading up to? Well I believe that an undocumented option to
: find will alleviate the problem. Certainly the "can't stat" message is no
: longer issued, and hopefully the hanging no longer occurs also.
:
: The -mount option to find appears to restrict the activities of the
: command to the mounted partition(s) specified in the pathname-list. Thus
: the other common root crontab entry would be written something like:
:
: 15 2 * * * find / /usr /home -mount -name core -atime +1 -exec rm {} \;
I have been using -xdev to prevent 'find' from going into mount points.
("-xdev" is documented in the man pages). Therefore I was very curious
as to the difference between the -xdev and -mount options.
Here's what I found:
% df
Filesystem kbytes used avail capacity Mounted on
/dev/sd0a 7855 3071 3998 43% /
/dev/sd0g 172117 142655 12250 92% /usr
/dev/sd0h 352909 288956 28662 91% /export
tardis:/var/spool/mail 61418 40105 15171 73% /var/spool/mail
tardis:/home/tardis 596610 519868 17081 97% /home/tardis
swap 37424 0 37424 0% /tmp
% find / -xdev -print >temp.1
% find / -mount -print >temp.2
% diff temp.1 temp.2
3,4d2
< /export 4.2 mount point
< /usr 4.2 mount point
8d5
< /home/tardis nfs mount point
252d248
< /tmp tmpfs mount point
286d281
< /var/spool/mail nfs mount point
The end result is that -xdev tells 'find' to process mount points as if
the were empty directories. (The directory is visible, but the files
inside it are not.) The -mount option tells 'find' to completely ignore
any mount point not explicitly listed on the command line. (The directory
is invisible.)
--
Joe Smith (408)922-6220 | SMTP: jms at tardis.tymnet.com or jms at gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C51 | BIX: smithjoe | CA license plate: "POPJ P," (PDP-10)
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga 3000 speaks for me."
More information about the Comp.sys.sun
mailing list