Re: Setting up server environment for twisted application

Richard Wall <[email protected]>
Newsgroups gmane.comp.python.twisted.web
Message-ID <CABefbUpjRGBPuQEVVT2F8ZQA-8SKRiTZSY48=a91KcgmfnMiZQ@mail.gmail.com>
On 16 July 2011 04:58, Christopher Armstrong <[email protected]> wrote:
> On Fri, Jul 15, 2011 at 10:49 PM, Viatcheslav Gachkaylo
> <[email protected]> wrote:
>> be always uptime and relaunch on fatal error. I am sure there is a
>> common procedure for this.
> I like using Supervisor (http://supervisord.org/) for this purpose, running
> with "twistd -n".

Also don't forget twisted.runner.procmon and  twistd procmon - it
hasn't got all the features of supervisord, but it may be enough. eg
twistd --logfile=procmon.log --pidfile=procmon.pid procmon \
    twistd --logfile=web.log --pidfile=web.pid -n web --path .

{{{
$ twistd procmon --help
Usage: twistd [options] procmon [procmon options] commandline
Options:
  -t, --threshold=        How long a process has to live before the death is
                          considered instant, in seconds. [default: 1]
  -k, --killtime=         How long a process being killed has to get its affairs
                          in order before it gets killed with an unmaskable
                          signal. [default: 5]
  -m, --minrestartdelay=  The minimum time (in seconds) to wait before
                          attempting to restart a process [default: 1]
  -M, --maxrestartdelay=  The maximum time (in seconds) to wait before
                          attempting to restart a process [default: 3600]
      --version
      --help              Display this help and exit.

procmon runs processes, monitors their progress, and restarts them when they
die.

procmon will not attempt to restart a process that appears to die instantly;
with each "instant" death (less than 1 second, by default), it will delay
approximately twice as long before restarting it. A successful run will reset
the counter.
}}}

-RichardW.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.