[Twisted-web] Setting up server environment for twisted application

Richard Wall m-lists at the-moon.net
Sat Jul 16 08:42:20 EDT 2011

On 16 July 2011 04:58, Christopher Armstrong <radix at twistedmatrix.com> wrote:
> On Fri, Jul 15, 2011 at 10:49 PM, Viatcheslav Gachkaylo
> <vgachkaylo at gmail.com> 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
  -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]
      --help              Display this help and exit.

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

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.


More information about the Twisted-web mailing list