lot_manager/tool.py

20 lines
579 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):
cmd = json.loads(msg.payload.decode('utf-8'))["cmd"]
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)