[Twisted-Python] Running a twisted application as windows service
Hello all, I have written a nice twisted-based TCP-server as a twistd plugin or an application as a .tac file and I would like to run it as a windows service. It works when started from cmd.exe but I would like to run it as a native service. I have seen that the pywin32 package has a win32serviceutil module which could be used for this. Unfortunately I do not know how to get it up and running. I have seen several posts here on this list about this topic but it is still unclear how to use it. For my understanding one has to mimic the life-cycle management of the process which twist(d) does in the windows service. Once it has been figured out I would love to clean it all up and add it to twisted's documentation. Thanks for your help, Thomas
I think you will find this blog post will tell you all you need to know. There are 3 separate blogs covering twisted as a windows service http://www.christianlong.com/blog/archives.html Regards John Aherne On Thu, Apr 12, 2018 at 5:12 PM, Thomas Westfeld < thomas.westfeld@currenta.de> wrote:
Hello all,
I have written a nice twisted-based TCP-server as a twistd plugin or an application as a .tac file and I would like to run it as a windows service.
It works when started from cmd.exe but I would like to run it as a native service.
I have seen that the pywin32 package has a win32serviceutil module which could be used for this. Unfortunately I do not know how to get it up and running.
I have seen several posts here on this list about this topic but it is still unclear how to use it. For my understanding one has to mimic the life-cycle management of the process which twist(d) does in the windows service.
Once it has been figured out I would love to clean it all up and add it to twisted's documentation.
Thanks for your help, Thomas
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- *John Aherne* *www.rocs.co.uk <http://www.rocs.co.uk>* 020 7223 7567
On Thu, Apr 12, 2018 at 12:12 PM, Thomas Westfeld < thomas.westfeld@currenta.de> wrote:
Hello all,
I have written a nice twisted-based TCP-server as a twistd plugin or an application as a .tac file and I would like to run it as a windows service.
Hi Thomas: Recommend you take a look at this service manager utility for Windows: https://nssm.cc/ We've moved away from implementing Twisted as a service and instead run it under NSSM. NSSM provides additional capabilities such as automatic restarts on failure, redirected stdout/stderr, and easily setting dependency groups, etc. Our Twisted binaries are installed at a number of fairly large companies and so far none of them have had any concern about running the NSSM service manager. Its made our life much simpler. (Lousy product name, though...) --Ray -- Raymond Cote, President voice: +1.603.924.6079 email: rgacote@AppropriateSolutions.com skype: ray.cote Schedule a meeting: https://calendly.com/ray_cote/60min/
+1 never seen NSSM crash Werner On 04/12/2018 07:50 AM, Ray Cote wrote:
On Thu, Apr 12, 2018 at 12:12 PM, Thomas Westfeld <thomas.westfeld@currenta.de <mailto:thomas.westfeld@currenta.de>> wrote:
Hello all,
I have written a nice twisted-based TCP-server as a twistd plugin or an application as a .tac file and I would like to run it as a windows service.
Hi Thomas: Recommend you take a look at this service manager utility for Windows: https://nssm.cc/ We've moved away from implementing Twisted as a service and instead run it under NSSM. NSSM provides additional capabilities such as automatic restarts on failure, redirected stdout/stderr, and easily setting dependency groups, etc. Our Twisted binaries are installed at a number of fairly large companies and so far none of them have had any concern about running the NSSM service manager. Its made our life much simpler. (Lousy product name, though...)
--Ray
-- Raymond Cote, President voice: +1.603.924.6079 email: rgacote@AppropriateSolutions.com skype: ray.cote Schedule a meeting: https://calendly.com/ray_cote/60min/
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
+1 never seen NSSM crash Werner On 04/12/2018 07:50 AM, Ray Cote wrote: On Thu, Apr 12, 2018 at 12:12 PM, Thomas Westfeld <thomas.westfeld@currenta.de> wrote: Hello all, I have written a nice twisted-based TCP-server as a twistd plugin or an application as a .tac file and I would like to run it as a windows service. Hi Thomas: Recommend you take a look at this service manager utility for Windows: https://nssm.cc/ We've moved away from implementing Twisted as a service and instead run it under NSSM. NSSM provides additional capabilities such as automatic restarts on failure, redirected stdout/stderr, and easily setting dependency groups, etc. Our Twisted binaries are installed at a number of fairly large companies and so far none of them have had any concern about running the NSSM service manager. Its made our life much simpler. (Lousy product name, though...) --Ray Thank you very much for the feedback. It seems not very pythonic to install a helper to generate a service. At the end of the day if it is robust then I will go for it. I would prefer a solution which would be installable via pip nicely. Just run pip install, then it will have a separate module which will then install the windows service and that's it. Thinking about making twisted easier to use in a windows environment this could be worth to include in the standard installation of twisted.
participants (4)
-
John Aherne
-
Ray Cote
-
Thomas Westfeld
-
Werner Thie