On Thu, Dec 28, 2000 at 11:36:50PM +1300, Dan Langille wrote:
> On 28 Dec 2000, at 11:29, Volker Stolz wrote:
> 
> > Am 28. Dec 2000 um 10:33 MET schrieb Dan Langille:
> > > What about a daemon signalling a waiting perl script?
> > > Is it an issue if the daemon signals the perl script when it's already 
> > > processing?  Could a signal be missed?
> > 
> > How about using a FIFO (maybe in /tmp) and let the daemon printf,echo,cat,...
> > control-msgs into the FIFO and have a perl script sitting on the other end?
> 
> That sounds good to me.  It meets the criteria.

Actually, there's no need for the FIFO.  What I've been thinking about
is a little C program that spawns a Perl script, then sits, watching
the spool directory through the kevent interface.  When a new file
appears, the parent lets the child know - this need not be signal-based,
I'm thinking more along the lines of writing to a previously-opened pipe.

This has the added benefit that the parent can monitor the child's status,
and respawn it if it dies; with separate processes and a FIFO, if the reader
dies, the writer either blocks or goes haywire, judging from my (admittedly
limited) experience.  Handling SIGCHLD and respawning seems easy :)  Also,
the Perl child can find out the parent has died (the pipe shall close or
something), and die gracefully, to be reborn as the parent is respawned.

Respawning the parent could be done as either a /etc/inittab-respawned
process, or a service running under svscan from DJB's daemontools package.
The latter case also has a almost-built-in logging with support for log
rotation through multilog.

G'luck,
Peter

-- 
If you think this sentence is confusing, then change one pig.


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

Reply via email to