From 88f9100edcba9581214c1a0acc23cd33a821a9c6 Mon Sep 17 00:00:00 2001
From: wangrong <wangrong@shsening.com>
Date: 星期六, 05 四月 2025 01:24:53 +0800
Subject: [PATCH] update the Gate start always
---
main.py | 20 ++++++--------------
1 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/main.py b/main.py
index ffb86f1..2f4afbf 100644
--- a/main.py
+++ b/main.py
@@ -284,28 +284,20 @@
try:
current_time = datetime.now()
current_hour = current_time.hour
-
- if stop_start_hour <= current_hour < stop_end_hour:
- logging.info("Within 00:00 - 05:00, stopping all monitored processes.")
- for process in process_list:
- process_name = process.get("process_name")
- if not process_name or process_name=="Gate":
- continue
+ for process in process_list:
+ process_name = process.get("process_name")
+ if stop_start_hour <= current_hour < stop_end_hour and process_name!="Gate":
pids = get_process_pids(process_name)
if pids:
- stop_process(pids)
- else:
- for process in process_list:
- process_name = process.get("process_name")
- if not process_name:
- continue
+ stop_process(pids)
+ else:
pids = get_process_pids(process_name)
if not pids:
logging.warning(f"Process {process_name} is not running, starting...")
start_process(process)
except Exception as e:
logging.error(f"Monitoring processes encountered an exception: {e}")
-
+
time.sleep(interval_seconds) # 鎸夐厤缃椂闂撮棿闅旀鏌�
--
Gitblit v1.9.1