[英]Watchdog in python / subprocess
I'm looking to execute an application that then binds to a defined port if successful, and then poll it over http, if it fails, restart it (pretty much a single-process simple watchdog). 我希望执行一个应用程序,如果成功,则将其绑定到定义的端口,然后通过http对其进行轮询,如果失败,则重新启动它(几乎是一个单进程的简单看门狗)。 Looking at subprocess , but a bit unsure as to how to continue. 查看子流程 ,但不确定如何继续。 Can anyone point me on a path or something? 谁能指出我的道路或其他东西?
The process has no stdin, no stdout, and no stderr (all can be discarded). 该进程没有stdin,stdout和stderr(都可以丢弃)。 Just pretty much a loop that checks if it responds (via urllib/Requests?) then sleep 30 seconds. 几乎是一个循环,检查它是否响应(通过urllib / Requests?),然后休眠30秒。
I'm looking to execute an application 我正在寻找执行一个应用程序
subprocess module........................ 子流程模块........................
http://docs.python.org/3/library/subprocess.html#replacing-older-functions-with-the-subprocess-module http://docs.python.org/3/library/subprocess.html#replacing-older-functions-with-the-subprocess-module
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.