update
This commit is contained in:
parent
574cc4e2c6
commit
ed61de0b10
|
@ -1,5 +1,5 @@
|
|||
[program:record]
|
||||
directory=/home/pi/lot_manager/src
|
||||
directory=/home/pi/lot_manager/bash
|
||||
command=/usr/bin/bash record.sh
|
||||
user=pi
|
||||
;是否随开机自启 或者reload自启动
|
||||
|
|
|
@ -3,8 +3,8 @@ set -e
|
|||
# git更新
|
||||
git pull origin master --force
|
||||
# 配置文件复制到supervisor管理
|
||||
cp -r ../conf/common/*.conf /etc/supervisor/conf.d/
|
||||
cp -r ../conf/var/$device_name/*.conf /etc/supervisor/conf.d/
|
||||
cp -r conf/common/*.conf /etc/supervisor/conf.d/
|
||||
cp -r conf/var/$device_name/*.conf /etc/supervisor/conf.d/
|
||||
# 更新配置文件
|
||||
supervisorctl reread
|
||||
supervisorctl update
|
|
@ -7,13 +7,13 @@ def on_connect(client, userdata, flags, rc):
|
|||
global times
|
||||
if rc == 0:
|
||||
# print("连接成功,执行数据推送和本地存储")
|
||||
subprocess.Popen(['/usr/bin/bash start_data_upload.sh'], shell=True)
|
||||
subprocess.Popen(['/usr/bin/bash /home/pi/lot_manager/bash/start_data_upload.sh'], shell=True)
|
||||
times = 3
|
||||
|
||||
|
||||
def on_connect_fail(client, userdata):
|
||||
# print("失败,执行本地存储")
|
||||
subprocess.Popen(['/usr/bin/bash stop_data_upload.sh'], shell=True)
|
||||
subprocess.Popen(['/usr/bin/bash /home/pi/lot_manager/bash/stop_data_upload.sh'], shell=True)
|
||||
|
||||
|
||||
times = 3
|
||||
|
|
14
src/tool.py
14
src/tool.py
|
@ -8,14 +8,15 @@ mp4_path = '/home/pi/mp4'
|
|||
|
||||
|
||||
def push_stream(client):
|
||||
p = subprocess.Popen(['/bin/bash start_push.sh'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen(['/bin/bash /home/pi/lot_manager/bash/start_push_stream.sh'], shell=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
output = out.decode('utf-8')
|
||||
client.publish('success', payload=json.dumps(output, ensure_ascii=False), qos=0)
|
||||
|
||||
|
||||
def close_stream(client):
|
||||
p = subprocess.Popen(['/bin/bash stop_push.sh'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen(['/bin/bash /home/pi/lot_manager/bash/stop_push_stream.sh'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
output = out.decode('utf-8')
|
||||
client.publish('success', payload=json.dumps(output, ensure_ascii=False), qos=0)
|
||||
|
@ -43,7 +44,10 @@ def get_status(client):
|
|||
|
||||
|
||||
def update(client):
|
||||
p = subprocess.Popen(['/bin/bash update.sh'], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
p = subprocess.Popen(['/bin/bash /home/pi/lot_manager/git_update.sh'],
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
output = out.decode('utf-8')
|
||||
client.publish('success', payload=json.dumps(output, ensure_ascii=False), qos=0)
|
||||
|
@ -60,7 +64,7 @@ def get_list_record():
|
|||
def get_record(msg, client):
|
||||
filename = json.loads(msg.payload.decode('utf-8'))["data"]
|
||||
if filename is None or filename == '':
|
||||
client.publish('error', payload='没有该文件', qos=1)
|
||||
client.publish('error', payload='没有该文件', qos=0)
|
||||
return
|
||||
files = {filename: open(os.path.join(mp4_path, filename), 'rb'), "Content-Type": "application/octet-stream"}
|
||||
requests.post("https://shop.lihaink.cn/api/index/upload", files=files)
|
||||
requests.post("https://shop.lihaink.cn/api/index/upload", files=files)
|
||||
|
|
Loading…
Reference in New Issue