Him Joseph!

I need something to read max 30 or so chars from a named pipe and execute
my script with that keyword.

Something that I can daemonize with an init script.

Seen anything similar that can be bent into shape?

Hmm, daemonizing perl scripts was discussed on PerlMonks, for example
<http://www.perlmonks.org/index.pl?node_id=478839>

In the "Perl Cookbook", there's also a short example for this, it's '17.17 Making a Daemon Server', Page 706 in the 2nd Edition.

But beware: You can't read in from stdin after daemonizing. Usually, you have two programs running, one daemon (e.g. continuously
running background program) and one scheduling script.

Ok, here's an idea, that might work:
Make some "spooling" directory. The scheduler generates "command" files with unique names, probably a string like
time() . rand(100000)
should suffice as filename. To be on the save side, you should make sure you don't have "incomplete" files in that directory: generate the file elsewhere and move it into the spool. This should be easy to write in a number of scripting languages.

The real daemon then scans the directory every few seconds, executing any command it finds.

This way, you still got a daemon that sequentially runs all commands, but you can be very flexible how you do the spooling.

(This should be a good opportunity for you to experiment and come up with your own solution, therefore i'm not going to give you a complete solution).

LG
Rene

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to