fix running instead of sleep for X

This commit is contained in:
2025-05-15 20:02:19 +10:00
parent fc47142a2c
commit f98340bff6
4 changed files with 13 additions and 7 deletions
+4 -2
View File
@@ -505,8 +505,10 @@ def run_google_trends_automator():
if not post_data:
logging.info("No postable Google Trend found")
logging.info("Completed Google Trends run")
update_system_activity(SCRIPT_NAME, "stopped") # Record stop
logging.info(f"Run completed, sleep_time: {sleep_time} seconds")
# Sleep while still marked as running
time.sleep(sleep_time)
update_system_activity(SCRIPT_NAME, "stopped") # Record stop after sleep
return post_data, category, sleep_time
except Exception as e:
logging.error(f"Fatal error in run_google_trends_automator: {e}", exc_info=True)
@@ -523,4 +525,4 @@ def run_google_trends_automator():
if __name__ == "__main__":
setup_logging()
post_data, category, sleep_time = run_google_trends_automator()
logging.info(f"Run completed, sleep_time: {sleep_time} seconds")
# logging.info(f"Run completed, sleep_time: {sleep_time} seconds")
+3 -1
View File
@@ -544,8 +544,10 @@ def run_reddit_automator():
if not post_data:
logging.info("No postable Reddit article found")
logging.info("Completed Reddit run")
update_system_activity(SCRIPT_NAME, "stopped") # Record stop
logging.info(f"Run completed, sleep_time: {sleep_time} seconds")
# Sleep while still marked as running
time.sleep(sleep_time)
update_system_activity(SCRIPT_NAME, "stopped") # Record stop after sleep
return post_data, category, sleep_time
except Exception as e:
logging.error(f"Fatal error in run_reddit_automator: {e}", exc_info=True)
+4 -2
View File
@@ -458,8 +458,10 @@ def run_rss_automator():
if not post_data:
logging.info("No postable RSS article found")
logging.info("Completed RSS run")
update_system_activity(SCRIPT_NAME, "stopped") # Record stop
logging.info(f"Run completed, sleep_time: {sleep_time} seconds")
# Sleep while still marked as running
time.sleep(sleep_time)
update_system_activity(SCRIPT_NAME, "stopped") # Record stop after sleep
return post_data, category, sleep_time
except Exception as e:
logging.error(f"Fatal error in run_rss_automator: {e}", exc_info=True)
@@ -475,4 +477,4 @@ def run_rss_automator():
if __name__ == "__main__":
post_data, category, sleep_time = run_rss_automator()
logging.info(f"Run completed, sleep_time: {sleep_time} seconds")
# logging.info(f"Run completed, sleep_time: {sleep_time} seconds")
+2 -2
View File
@@ -93,8 +93,8 @@ stop_scripts() {
import json, os
f = '/home/shane/foodie_automator/system_activity.json'
if os.path.exists(f):
with open(f) as fh:
data = json.load(f)
with open(f, 'r') as fh:
data = json.load(fh)
changed = False
for entry in data:
if entry.get('status') == 'running':