I have some raspberry pi
running some python
code. Once and a while my devices will fail to check in. The rest of the python code continues to run perfectly but the code here quits. I am not sure why? If the devices can't check in they should reboot but they don't. Other threads in the python
file continue to run correctly.
class reportStatus(Thread):def run(self):checkInCount = 0while 1:try:if checkInCount < 50:payload = {'d':device,'k':cKey}resp = requests.post(url+'c', json=payload)if resp.status_code == 200:checkInCount = 0time.sleep(1800) #1800else:checkInCount += 1time.sleep(300) # 2.5 minelse:os.system("sudo reboot")except:try:checkInCount += 1time.sleep(300)except:pass
The devices can run for days and weeks and will check in perfectly every 30 minutes, then out of the blue they will stop. My linux
computers are in read-only and the computer continue to work and run correctly. My issue is in this thread. I think they might fail to get a response and this line could be the issue
resp = requests.post(url+'c', json=payload)
I am not sure how to solve this, any help or suggestions would be greatly appreciated.
Thank you