Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Sep 2003 16:05:14 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Vitali Malicky <life@zone3000.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: I need to control a bunch of files.
Message-ID:  <20030905150514.GC79611@happy-idiot-talk.infracaninophile.co.uk>
In-Reply-To: <004201c373aa$7b67f170$2401010a@zone3000.net>
References:  <004201c373aa$7b67f170$2401010a@zone3000.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--H8ygTp4AXg6deix2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Sep 05, 2003 at 03:37:34PM +0300, Vitali Malicky wrote:

> There is  a question, sorry if you find it stupid.
>=20
> I need to control a bunch of files.
>=20
> As soon as any of these files changes it should be immediately
> rechecked and correct chmod and chown reset on this file(s).
>=20
> 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.
>=20
> 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

--=20
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

--H8ygTp4AXg6deix2
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/WKYqdtESqEQa7a0RAuSzAJ9BW1KF8ruELHmKLVb2SEaDh5KkOACfbOzO
4f7oQXywj1mU6XFjxCBxvTg=
=TUER
-----END PGP SIGNATURE-----

--H8ygTp4AXg6deix2--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030905150514.GC79611>