try
This commit is contained in:
+6
-2
@@ -1689,16 +1689,20 @@ def is_any_script_running():
|
||||
activity_file = "/home/shane/foodie_automator/system_activity.json"
|
||||
try:
|
||||
activities = load_json_file(activity_file, default=[])
|
||||
logging.debug(f"[DEBUG] system_activity.json contents: {activities}")
|
||||
for entry in activities:
|
||||
logging.debug(f"[DEBUG] Checking entry: {entry}")
|
||||
if entry.get("status") == "running" and entry.get("pid"):
|
||||
try:
|
||||
# Verify the process is still running
|
||||
import psutil
|
||||
process = psutil.Process(entry["pid"])
|
||||
if process.is_running():
|
||||
logging.debug(f"[DEBUG] Found running process: {entry['pid']}")
|
||||
return True
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logging.debug(f"[DEBUG] Exception checking process: {e}")
|
||||
continue
|
||||
logging.debug("[DEBUG] No running scripts found.")
|
||||
return False
|
||||
except Exception as e:
|
||||
logging.error(f"Failed to check system_activity.json: {e}")
|
||||
|
||||
Reference in New Issue
Block a user