From owner-freebsd-questions@FreeBSD.ORG Fri Sep 5 08:06:00 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78B7016A4BF for ; Fri, 5 Sep 2003 08:06:00 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (happy-idiot-talk.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7743A43F85 for ; Fri, 5 Sep 2003 08:05:58 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [127.0.0.1]) h85F5FQr080218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 5 Sep 2003 16:05:52 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)h85F5FaJ080217; Fri, 5 Sep 2003 16:05:15 +0100 (BST) (envelope-from matthew) Date: Fri, 5 Sep 2003 16:05:14 +0100 From: Matthew Seaman To: Vitali Malicky Message-ID: <20030905150514.GC79611@happy-idiot-talk.infracaninophile.co.uk> Mail-Followup-To: Matthew Seaman , Vitali Malicky , freebsd-questions@freebsd.org References: <004201c373aa$7b67f170$2401010a@zone3000.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="H8ygTp4AXg6deix2" Content-Disposition: inline In-Reply-To: <004201c373aa$7b67f170$2401010a@zone3000.net> User-Agent: Mutt/1.5.4i X-Spam-Status: No, hits=-11.4 required=5.0 tests=AWL,BAYES_00,EMAIL_ATTRIBUTION,IN_REP_TO,PGP_SIGNATURE_2, QUOTED_EMAIL_TEXT,REFERENCES,REPLY_WITH_QUOTES, USER_AGENT_MUTT autolearn=ham version=2.55 X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: freebsd-questions@freebsd.org Subject: Re: I need to control a bunch of files. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2003 15:06:00 -0000 --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--