Yes, it would be easy to add something like "echo $(date)
restarting..." in the loop, but I reckon this is already logged in the
paster log.

As for a python monitoring tool, yes I said I'm aware of those, it's
just that I don't want to waste 20MB for something that can be done by
a shell script (admittedly still consuming 1-2MB, which is too much).
A C program would be the best (e.g. daemontools), it's just that I
don't like daemontools and I didn't want to spend the time writing a
simplified daemontools-like program in C.

On Dec 29, 6:31 am, "Alex Marandon" <[email protected]> wrote:
> 2008/12/28 Tycon <[email protected]>:
>
>
>
>
>
> > 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
>
> This looks fine although you could also try to fetch a page and make
> assertions on the response, to make sure your users are not getting a
> 500 for example. I would also add some logging, as you probably want
> to trace back when the server had to be restarted, maybe even with an
> email notification. This would be easier to do if the script was in
> Python :-)
--~--~---------~--~----~------------~-------~--~----~
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