On 27 Dec 2000, at 19:56, Peter Pentchev wrote:

> On Wed, Dec 27, 2000 at 09:16:34AM -0800, Alfred Perlstein wrote:
> > * Dan Langille <[EMAIL PROTECTED]> [001226 23:50] wrote:
> > > 
> > > My idea is to have a daemon, or something resembling one, sitting on 
> > > the box watching the directory.  When a new file appears, it starts a perl 
> > > script.  This perl script is beyound the scope of my question, but it  
> > > processes all the files in the directory.  When finished, it looks for any 
> > > more files and repeats as necessary.  If no more files, it exits.
> > > 
> > 
> > This isn't an answer to your main question (i see it's already been
> > discussed), but you may be able to use setup a kevent on the
> > directory which should inform you if any files are added to it.
> 
> Unfortunately, I gather that Dan intends to write most of the FreshPorts
> code in Perl, and AFAIK, Perl has no kqueue/kevent interface :(

Unfortunately?  *grin*  FWIW, Most of the existing and new code will be 
PHP based.  Perl is used primarly for importing data from cvs-all.  And 
for various mailings out to users.

> Thus, to make use of kevent (which I certainly agree would be a better
> FreeBSD-specific solution), he'd have to either 1. have a C program
> which spawns Perl and his script on every change, or 2. have a C program
> which spawns Perl once and signals it on every change.
> 
> The first way would be downright stupid IMHO..  The second one may
> very well be more efficient than the readdir, sleep solution which
> I proposed in other postings, seeing that Dan wants to process
> the cvs-all mailings, which certainly do not arrive every few seconds :)

I like the 2nd concept.  It appeals to me.  I haven't done any C in about 
7 years and all of that was in Windows.  Never in a Unix environment.  
This solution is more complex than the "cron job every minute" which I 
discussed with Mark, but it fits with my goal of having processed the 
cvs-all messages as quickly as I can.

--
Dan Langille
The FreeBSD Diary - http://freebsddiary.org/
       FreshPorts - http://freshports.org/
     NZ Broadband - http://unixathome.org/broadband/


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to