简体   繁体   English

如何监控python wsgi服务器,当它崩溃时重新启动它

[英]how to monitor python wsgi server,when it crashed restart it

我有一个使用粘贴的wsgi服务器,由于某些未知的原因,它经常会崩溃,所以我想拥有一个应用程序,或者只是某个软件包可以帮助我解决这个问题,当它崩溃时会自动终止该进程并重新启动它。不客气。

I'd use your operational system's service integration to do that. 我会使用您的操作系统的服务集成来做到这一点。 For example, on debian linux, there's start-stop-daemon. 例如,在debian linux上,有start-stop-daemon。 On windows, there's the service management. 在Windows上,有服务管理。

It's the proven, well integrated way, provided by the operational system itself, to keep an application running. 这是操作系统本身提供的一种经过验证的,高度集成的方式,可以保持应用程序运行。

Just make your installation program register your service with the native service management system. 只需使您的安装程序在本机服务管理系统中注册您的服务即可。

You can use supervisord to run your service. 您可以使用超级用户来运行您的服务。 It provides auto-restart option in a program configuration. 它在程序配置中提供了自动重新启动选项。 You can reference to the autorestart section in this document . 您可以参考本文档中的autorestart部分。

To know how to use it with Python, you can reference to my answer on this topic . 要了解如何在Python中使用它,您可以参考我对此主题的回答。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM