From d2c7f4f28c106ca65d336463db40c6de2a6fd75b Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Tue, 5 Dec 2023 09:08:53 +0800 Subject: [PATCH] test --- conf/mqtt.conf | 2 +- tool.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/mqtt.conf b/conf/mqtt.conf index 997add5..69e9350 100644 --- a/conf/mqtt.conf +++ b/conf/mqtt.conf @@ -7,7 +7,7 @@ autostart=true ;失败重启 autorestart=true ;重启次数 -restart_times=3 +restart_times=10 redirect_stderr=true stopsignal=TERM stopasgroup=True diff --git a/tool.py b/tool.py index 63b6589..d653ce4 100644 --- a/tool.py +++ b/tool.py @@ -19,7 +19,10 @@ def exec_sh(msg): cmd = json.loads(msg.payload.decode('utf-8'))["data"] if cmd == "supervisorctl stop __mqtt__": return - subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + out, err = p.communicate() + output = out.decode('utf-8') + print(output) def update():