supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
* supervising an apache RewriteMap program?
@ 2007-05-09 22:29 Robin Bowes
  2007-06-02 16:50 ` Charlie Brady
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Robin Bowes @ 2007-05-09 22:29 UTC (permalink / raw)
  To: supervision

Hi,

I'm using perl script as an Apache RewriteMap program [1]

Basically, this is started when apache starts and communication is via 
stdin and stdout. A simple program (the example from the link below) is:

#!/usr/bin/perl
$| = 1;
while (<STDIN>) {
     # ...put here any transformations or lookups...
     print $_;
}

I'm using a much more complex example that does DB lookups, etc.

The problem arises when the program exits or dies for some reason - 
apache doesn't restart it.

I'm wondering, could I use supervise or runsv to make sure the rewrite 
map program is restarted?

First issue - the rewritemap program can't take parameters, i.e. it has 
to be specified as a single word. So, I guess I could use a script that 
execs runsv, e.g.:

RewriteMap aypFilterMap    prg:/usr/bin/rewritemap_wrapper.sh

rewritemap_wrapper.sh:
====================================================
#!/bin/bash
exec runsv /var/apache/rewritemap
====================================================

/var/apache/rewritemap/run:
====================================================
#!/bin/bash
exec /usr/bin/myrewritemap.pl
====================================================

Second issue - as I mentioned earlier, apache communicates with the 
rewrite map program through its stdin and stdout. It writes to the 
program's stdin and reads from its stdout.

In normal use, the connected processes are simply:

apache<->myrewritemap.pl

In the configuration above, it's more complex:

apache<->rewritemap_wrapper.sh<->runsv<->run<->myrewritemap.pl

Using the configuration above, would the apache process be connected to 
the stdin and stdout of the myrewritemap.pl script?

What about if/when the myrewritemap.pl script exits and is restarted?

Thanks for any insight into this.

Cheers,

R.

[1] http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritemap


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-02 21:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-09 22:29 supervising an apache RewriteMap program? Robin Bowes
2007-06-02 16:50 ` Charlie Brady
2007-06-02 19:06 ` Robin Bowes
2007-06-02 21:00 ` Scott Gifford

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).