This commit is contained in:
xyj 2024-01-05 16:49:13 +08:00
parent 633212d0e1
commit c557c4c69f
1 changed files with 7 additions and 2 deletions

View File

@ -195,6 +195,7 @@ def get_data():
t2 = LOT_DATA(**data)
client.publish(publish_topic, payload=json.dumps(data, ensure_ascii=False), qos=0)
add(t2)
# 运行一次就把这个程序关掉
subprocess.Popen(
["/usr/bin/bash /home/pi/lot_manager/conf/example/bash/stop_dataupload_internal_one_hour.sh"],
shell=True)
@ -227,6 +228,10 @@ def p():
t2 = LOT_DATA(**data)
client.publish(publish_topic, payload=json.dumps(data, ensure_ascii=False), qos=0)
add(t2)
# 运行一次就把这个程序关掉
subprocess.Popen(
["/usr/bin/bash /home/pi/lot_manager/conf/example/bash/stop_dataupload_internal_one_hour.sh"],
shell=True)
except Exception as e:
# print(e)
pass
@ -235,9 +240,9 @@ def p():
def on_connect(client, userdata, flags, rc):
if rc == 0:
# 测试
# threading.Thread(target=p).start()
threading.Thread(target=p).start()
# 正式环境
threading.Thread(target=get_data).start()
# threading.Thread(target=get_data).start()
if __name__ == '__main__':