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():