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