|
|
|
@ -1684,15 +1684,16 @@ def prune_system_activity(tweet_reset_time): |
|
|
|
def is_any_script_running(): |
|
|
|
def is_any_script_running(): |
|
|
|
""" |
|
|
|
""" |
|
|
|
Check if any script is running by inspecting system_activity.json and verifying PIDs. |
|
|
|
Check if any script is running by inspecting system_activity.json and verifying PIDs. |
|
|
|
Returns True if at least one script is running, False otherwise. |
|
|
|
Returns True if at least one script (other than the current process) is running, False otherwise. |
|
|
|
""" |
|
|
|
""" |
|
|
|
activity_file = "/home/shane/foodie_automator/system_activity.json" |
|
|
|
activity_file = "/home/shane/foodie_automator/system_activity.json" |
|
|
|
|
|
|
|
current_pid = os.getpid() |
|
|
|
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}") |
|
|
|
logging.debug(f"[DEBUG] system_activity.json contents: {activities}") |
|
|
|
for entry in activities: |
|
|
|
for entry in activities: |
|
|
|
logging.debug(f"[DEBUG] Checking entry: {entry}") |
|
|
|
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") and entry.get("pid") != current_pid: |
|
|
|
try: |
|
|
|
try: |
|
|
|
import psutil |
|
|
|
import psutil |
|
|
|
process = psutil.Process(entry["pid"]) |
|
|
|
process = psutil.Process(entry["pid"]) |
|
|
|
|