This commit is contained in:
xyj 2023-12-05 09:45:55 +08:00
parent 2e8fe15fc7
commit f9ef08b4b8
1 changed files with 2 additions and 2 deletions

View File

@ -23,9 +23,9 @@ def close_stream(client):
def exec_sh(msg, client): def exec_sh(msg, client):
cmd = json.loads(msg.payload.decode('utf-8'))["data"] cmd = json.loads(msg.payload.decode('utf-8'))["data"]
if cmd == "supervisorctl stop __mqtt__": if cmd == "supervisorctl stop __mqtt__" or cmd == "supervisorctl restart __mqtt__":
return return
if cmd == "supervisorctl restart __mqtt__" or cmd == "supervisorctl reload": if cmd == "supervisorctl reload":
subprocess.Popen([cmd], shell=True) subprocess.Popen([cmd], shell=True)
return return
p = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)