From: Robin Bowes <robin-lists@robinbowes.com>
To: supervision@list.skarnet.org
Subject: supervising an apache RewriteMap program?
Date: Wed, 09 May 2007 23:29:01 +0100 [thread overview]
Message-ID: <46424B2D.3010109@robinbowes.com> (raw)
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
next reply other threads:[~2007-05-09 22:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-09 22:29 Robin Bowes [this message]
2007-06-02 16:50 ` Charlie Brady
2007-06-02 19:06 ` Robin Bowes
2007-06-02 21:00 ` Scott Gifford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46424B2D.3010109@robinbowes.com \
--to=robin-lists@robinbowes.com \
--cc=supervision@list.skarnet.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).