import time import subprocess import sys import os def run_scraper(): print(f"\n[{time.strftime('%Y-%m-%d %H:%M:%S')}] Starting data aggregation...") try: # Run aggregator.py (Startups) subprocess.run([sys.executable, "aggregator.py"], check=True) # Run ai_training_scraper.py (AI Training) subprocess.run([sys.executable, "ai_training_scraper.py"], check=True) print(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] All scrapers ran successfully.") except Exception as e: print(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Aggregation failed: {e}") if __name__ == "__main__": print("Firstify Auto-Scheduler Started.") print("Interval: 60 minutes") # Run once immediately on start run_scraper() while True: # Wait for 60 minutes time.sleep(3600) run_scraper()