Implement conditional reboot
This commit is contained in:
parent
4e1804bb06
commit
de8757d59f
@ -297,8 +297,11 @@ if __name__ == "__main__":
|
||||
grist_callback({ "Health": result["status"] })
|
||||
logger.info(f"Status: {result['status']} ()")
|
||||
if result["status"] == "Idle":
|
||||
grist_callback({ "Health": "Rebooting" })
|
||||
os.system("reboot")
|
||||
uptime_seconds = os.popen("cat /proc/uptime | cut -d'.' -f1").read()
|
||||
uptime_seconds = int(uptime_seconds)
|
||||
if uptime_seconds > 60*60*1:
|
||||
grist_callback({ "Health": "Rebooting" })
|
||||
os.system("reboot")
|
||||
except Exception as e:
|
||||
logger.error(f"Error on attempt {attempt+1}/3: {e}")
|
||||
if attempt == 2:
|
||||
|
Loading…
Reference in New Issue
Block a user