multisupervise or something like that...

"Hans-Christian Jehg" <[email protected]> Sat, 27 Jan 2007 13:46:51 +0100
Newsgroups gmane.comp.djb.syslog
Organization HoBSoft
Message-ID <026b01c74211$37bbcbc0$0200a8c0@HC1>
Hello All

I have been using daemontools for many years to keep my qmail setup running
with no problems at all.

Now I'm working with other things but I would still would like to use
daemontools to keep my stuff running...

What daemontools is good at is keeping a service running, namely one
instance of a program like:

 5039 ?        Ss     0:00 /bin/sh /command/svscanboot
 5113 ?        S      0:01  \_ svscan /service
 5115 ?        S      0:00  |   \_ supervise worker
25749 ?        S     11:41  |   |   \_ php worker.php
 5116 ?        S      0:00  |   \_ supervise log
25738 ?        S      0:00  |       \_ multilog t /var/log/worker
 
Now I would like to use daemontools to help me do something similar, but
with more instances of the same program (perhaps to take advantage of
multiple processors or to use the cpu, even when the service has dead time,
or...), but without creating multiple supervise directories(As they will all
do the same, and sometimes I may want to keep 50 running...).

 5039 ?        Ss     0:00 /bin/sh /command/svscanboot
 5113 ?        S      0:01  \_ svscan /service
 5115 ?        S      0:00  |   \_ supervise worker
25749 ?        S     11:41  |   |   \_ php worker.php
25750 ?        S     11:39  |   |   \_ php worker.php
25751 ?        S     11:20  |   |   \_ php worker.php
25752 ?        S     11:05  |   |   \_ php worker.php
 5116 ?        S      0:00  |   \_ supervise log
25738 ?        S      0:00  |       \_ multilog t /var/log/worker

Or

 5039 ?        Ss     0:00 /bin/sh /command/svscanboot
 5113 ?        S      0:01  \_ svscan /service
 5115 ?        S      0:00  |   \_ supervise worker
25749 ?        S     11:41  |   |   \_ php worker.php
 5117 ?        S      0:00  |   \_ supervise worker
25750 ?        S     11:39  |   |   \_ php worker.php
 5118 ?        S      0:00  |   \_ supervise worker
25751 ?        S     11:20  |   |   \_ php worker.php
 5119 ?        S      0:00  |   \_ supervise worker
25752 ?        S     11:05  |   |   \_ php worker.php
 5116 ?        S      0:00  |   \_ supervise log
25738 ?        S      0:00  |       \_ multilog t /var/log/worker

Or

 5039 ?        Ss     0:00 /bin/sh /command/svscanboot
 5113 ?        S      0:01  \_ svscan /service
 5115 ?        S      0:00  |   \_ supervise worker
 5117 ?        S      0:00  |   |   \_ multisupervise 4 php worker.php
25749 ?        S     11:41  |   |       \_ php worker.php
25750 ?        S     11:39  |   |       \_ php worker.php
25751 ?        S     11:20  |   |       \_ php worker.php
25752 ?        S     11:05  |   |       \_ php worker.php
 5116 ?        S      0:00  |   \_ supervise log
25738 ?        S      0:00  |       \_ multilog t /var/log/worker

Or ?

Of course this would demand that the service running outputs logs in a
sensible way (in the last example this could be taken care of by the
multisupervise program), or the use of recordio or something similar, to be
able to decifer the log.

Maybe it could be activated by another controlfile next to run containing
the number of instances you want to start or perhaps in the supervise
directory (maybe activated by svc -m4 for now run 4 instances.  Kill some if
there are too many or start some new ones if there are too few svc -m1 would
be similar to svc -u ).

Does anyone have any good ideas on how to achieve this ?

Thank you very much in advance :-)

Hans-Christian Jehg