From e1af79bac9d92a28aa0af64ab4fb3d16061866db Mon Sep 17 00:00:00 2001 From: vvzvlad Date: Fri, 11 Apr 2025 01:07:54 +0300 Subject: [PATCH] enhance health check --- checker.py | 8 +++++--- ritual.code-workspace | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 ritual.code-workspace diff --git a/checker.py b/checker.py index 1a7a123..cd6a297 100644 --- a/checker.py +++ b/checker.py @@ -282,7 +282,7 @@ if __name__ == "__main__": #time.sleep(random_sleep) grist_data = {} - with open('/root/node/grist.json', 'r', encoding='utf-8') as f: + with open('/root/node/grist_1.json', 'r', encoding='utf-8') as f: grist_data = json.loads(f.read()) GRIST_ROW_NAME = socket.gethostname() @@ -295,8 +295,10 @@ if __name__ == "__main__": try: result = check_logs(logger) grist_callback({ "Health": result["status"] }) - logger.info(f"Status: {result['status']}") - break + logger.info(f"Status: {result['status']} ()") + if result["status"] == "Idle": + grist_callback({ "Health": "Rebooting" }) + os.system("reboot") except Exception as e: logger.error(f"Error on attempt {attempt+1}/3: {e}") if attempt == 2: diff --git a/ritual.code-workspace b/ritual.code-workspace new file mode 100644 index 0000000..46b2afb --- /dev/null +++ b/ritual.code-workspace @@ -0,0 +1,27 @@ +{ + "folders": [ + { + "path": "." + }, + { + "path": "../ritual-git" + } + ], + "settings": { + "workbench.colorCustomizations": { + "activityBar.activeBackground": "#fb94f8", + "activityBar.background": "#fb94f8", + "activityBar.foreground": "#15202b", + "activityBar.inactiveForeground": "#15202b99", + "activityBarBadge.background": "#777b05", + "activityBarBadge.foreground": "#e7e7e7", + "commandCenter.border": "#15202b99", + "sash.hoverBorder": "#fb94f8", + "titleBar.activeBackground": "#f963f5", + "titleBar.activeForeground": "#15202b", + "titleBar.inactiveBackground": "#f963f599", + "titleBar.inactiveForeground": "#15202b99" + }, + "peacock.color": "#f963f5" + } +} \ No newline at end of file