16 messages in com.googlegroups.pylons-discussRe: Daemonizing and auto-restart
FromSent OnAttachments
Mike Orr22 May 2007 11:59 
Shannon -jj Behrens22 May 2007 15:57 
voltron22 May 2007 16:04 
Ian Bicking22 May 2007 16:19 
Mike Orr22 May 2007 16:59 
Max Ischenko22 May 2007 21:24 
John_Nowlan24 May 2007 11:49 
Mike Orr24 May 2007 17:14 
Ian Bicking24 May 2007 19:05 
Shannon -jj Behrens24 May 2007 21:43 
Max Ischenko24 May 2007 22:49 
voltron25 May 2007 00:27 
Shannon -jj Behrens25 May 2007 06:35 
Ian Bicking25 May 2007 08:27 
Mike Orr18 Jun 2007 09:58 
Contact 4218 Jun 2007 20:07 
Subject:Re: Daemonizing and auto-restart
From:Ian Bicking (ianb@public.gmane.org)
Date:05/22/2007 04:19:30 PM
List:com.googlegroups.pylons-discuss

Mike Orr wrote:

I'm about to deploy my Pylons application and need to daemonize it and set up auto-restart if it dies. "paster serve production.ini start" does not daemonize it, contrary to what "paster serve --help" says. "paster serve --daemon production.ini" does, but it does not create a PID file so you can't stop it.

I made my configuration file executable and put this at the top:

#!/usr/bin/env paster [exe] command = serve daemon = true pid_file = %(here)/data/paster.pid log_file = %(here)/data/error.log

I can start it and stop it in daemon mode with "./production.ini start" and "./production.ini stop", but if I do "paster serve production.ini start" it starts up in normal console mode with logging to the console. Is this a bug in Paste?

I should probably just take the whole #! thing out, it's really finicky and platform-dependent. Linux and BSD are totally different, for instance, and BSD and OSX are also different from each other, I think. I like the pattern, it just shouldn't use "paster", it should use a completely different script dedicated to this purpose.

My other question is, paster has a --monitor-restart option to restart the server if it dies. But the Pylons Cookbook has recipes for daemontools and supervisor2. Are these better than paster's monitor for some reason, or are they all interchangeable?

They all work the same basic way. paster's is simpler, obviously, since it's just one option. But it hasn't been tested a whole lot, so I dunno. Also it probably has more overhead than daemontools, though I don't know if it really is significant.