[comp.lang.perl] unix process control with perl

larry@mitra.mitra.com (Larry Williamson) (04/10/91)

I have need of a system that can be used to startup a bunch of
programs. This system should be able to restart any process that has
died, or if desired, flag the death (ie. via syslog()).  The bunch of
programs to control should be obtained from an ascii file.

All in all, something similiar to the /etc/init & /etc/inittab on
System V machines.

There is an example of something similiar in 'the camel book'. I will
use that as a start, but am interested in something more complete if
it is available. 

I suppose it does not *have* to be a perl solution, but... :-)

Thanks.

-Larry

rbj@uunet.UU.NET (Root Boy Jim) (04/12/91)

In article <LARRY.91Apr10154921@mitra.mitra.com> larry@mitra.mitra.com (Larry Williamson) writes:
>I have need of a system that can be used to startup a bunch of
>programs. This system should be able to restart any process that has
>died, or if desired, flag the death (ie. via syslog()).  The bunch of
>programs to control should be obtained from an ascii file.

Have a table of commands you want to run. For each entry,
fork and record the command in an associative array indexed by
the child's pid. Then wait for a child to die. When it does,
restart that entry and record the new pid, or syslog it if it
was a one time thing.

>All in all, something similiar to the /etc/init & /etc/inittab on
>System V machines.

Indeed. With a bit of hacking you can create the internal table
from inittab itself.
-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane