diff --git a/checker.py b/checker.py index c811857..9cad7b7 100644 --- a/checker.py +++ b/checker.py @@ -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: