update
This commit is contained in:
parent
43c281546f
commit
c50880b8ae
6
tool.py
6
tool.py
|
@ -23,7 +23,11 @@ def close_stream(client):
|
|||
|
||||
def exec_sh(msg, client):
|
||||
cmd = json.loads(msg.payload.decode('utf-8'))["data"]
|
||||
if cmd == "supervisorctl stop __mqtt__" or cmd == "supervisorctl restart __mqtt__":
|
||||
if cmd == "supervisorctl stop __mqtt__":
|
||||
return
|
||||
if cmd == "supervisorctl restart __mqtt__" or cmd == "supervisorctl reload":
|
||||
subprocess.Popen([cmd], shell=True)
|
||||
client.publish('success', payload='Exec Success!', qos=0)
|
||||
return
|
||||
p = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
|
|
Loading…
Reference in New Issue