For people running the web app using paster http server (usually
behind a web server acting
as a reverse proxy), what kind of tool do you use to monitor your app
server (e.g. paster) ?

I've heard of supervisor, daemontools etc, but for my purpose a simple
shell script which acts as a
parent process of python/paster and just restarts it when it dies is
sufficient.

So, the script I came up with is :

#!/bin/bash
test -f $2 && exit
echo $$ > $2
trap 'kill $!; rm $2; exit' SIGTERM
while true; do $1 & wait; sleep 20; done

You use it by passing the command you want to execute and the name of
a file to store the process id (which must not exist beforehand), for
example:

$ monitor "paster serve production.ini" main.pid &

To terminate the monitor as well as the app it's monitoring (the
monitor script will kill the child app as well as remove the pid
file):

$ kill $(cat main.pid)

If for any reason the monitored application terminates, then the
monitor script will restart it after 20 seconds.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to