On Wed, Mar 5, 2008 at 7:16 AM, Adrian Schmitt <[EMAIL PROTECTED]> wrote: > > Hi, > > i am writing a controller that does some admin stuff. I would really > love to add a "restart pylons" functionality. > > How would I do this? Is there something built in? > > As I am monitoring the pylons process with daemontools (or monit on > another machine and on a windows machine i hav written my own tool > that monitors it), it would be sufficient to just stop the process, as > the monitoring tool would then start a new instance. > > It should work on all platforms, but if there is something that only > works on non-windows i would also be interested. > > Of course I can call some shell script that kills the process but I'd > prefer something more gracefully. Pages that are just being served > could maybe be finished serving. > > It is paster running the application, so maybe he could also stop it? > Is there a way to signal to paster to kill or restart the application? > > Is there a paster command that killls / stops gracefully the running > server?
Conceptually it's the same as what "paster serve --reload" does, but I'm not sure exactly how you'd implement it. On Unix the process could send itself a signal. A Python exception could be used as long as the middleware doesn't cach it, but I'm not sure if an exception in a worker thread can be recognized in the main thread. You could run with --reload and then touch one of the files that triggers a restart (os.utime), but that would be inefficient. If you're using an external daemon manager like 'supervisor', the controller could ask supervisor to restart the server. I'm not sure whether any of these are 'graceful', but I haven't seen a flurry of failed requests. -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
