[clug] How to "daemonize" a process
richard_c at tpg.com.au
Wed Jul 2 22:41:05 EST 2003
Michael.James at csiro.au wrote:
> How can I have an initialized, ready daemon
> that I can remotely call down onto a new pair of files?
I suppose it depends on what sort of program this is. I don't have time
for a complete solution (working); but some command involving a pipe (or
fifo if it must be a named file) as an input and then using Perl to
guess when processing's been done and nab the output file, truncate the
output file, and feed in a new file to be processed, repeat.
Perl allows you to write to a file handle, where the other end is stdin
for some command. You can just keep feeding the contents of the files
into that file handle.
If your program supports accepting work piped to stdin then it should be
fine, but if it demands a filename (and you feed it a stream via a fifo)
then it might have 'issues'.
My 2c. Flame away guys ;)
More information about the linux