I need to control a bunch of files.
Matthew Seaman
m.seaman at infracaninophile.co.uk
Fri Sep 5 08:06:00 PDT 2003
On Fri, Sep 05, 2003 at 03:37:34PM +0300, Vitali Malicky wrote:
> There is a question, sorry if you find it stupid.
>
> I need to control a bunch of files.
>
> As soon as any of these files changes it should be immediately
> rechecked and correct chmod and chown reset on this file(s).
>
> Though I can do it from a simple script executed by the cron every
> five minutes or so, I'd like them to be controlled by a process which
> would monitor any possible changes in these files and would do the
> job upon the event.
>
> Can anybody give me a hint?
Are you any good at C programming? If so, check out the man page for
kqueue(2) -- you can register a series of kevents with the kernel, and
it will inform your process whenever one of those events occurs. One
of the standard "event filters" is EVFILT_VNODE, which will tell you
when a vnode (ie file, in this case) gets modified, including such
changes as unlinking the file, renaming it, change of attributes
(ownership, mode) etc.
Cheers,
Matthew
--
Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks
Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614 Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030905/50a9db02/attachment.bin
More information about the freebsd-questions
mailing list