lot_manager/tool.py

20 lines
580 B
Python
Raw Normal View History

2023-12-01 15:12:41 +08:00
import json
2023-12-01 09:21:23 +08:00
import subprocess
def push_stream():
2023-12-01 15:12:41 +08:00
subprocess.Popen(['/bin/bash start_push.sh'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
2023-12-01 09:21:23 +08:00
def close_stream():
2023-12-01 15:12:41 +08:00
subprocess.Popen(['/bin/bash stop_push.sh'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
2023-12-01 09:21:23 +08:00
2023-12-01 15:12:41 +08:00
def exec_sh(msg):
2023-12-02 09:28:42 +08:00
cmd = json.loads(msg.payload.decode('utf-8'))["data"]
2023-12-01 15:12:41 +08:00
subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
2023-12-01 09:21:23 +08:00
def update():
2023-12-01 15:12:41 +08:00
subprocess.Popen(['/bin/bash update.sh'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)