diff --git a/sensor_to_server.py b/sensor_to_server.py index e31999f..ffda0c5 100755 --- a/sensor_to_server.py +++ b/sensor_to_server.py @@ -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__':