fix scheduler with separate script

This commit is contained in:
flo-eberle
2026-02-15 12:24:11 +01:00
parent 8b3e3a95ca
commit 82efdbf4be
2 changed files with 52 additions and 20 deletions

View File

@@ -21,26 +21,7 @@ services:
- ./.env:/app/.env:ro
environment:
- TZ=Europe/Vienna
command: >
python -c "
import schedule
import time
from src.main import FlatScraper
def run_scraper():
scraper = FlatScraper()
scraper.run_once()
# Schedule every 6 hours
schedule.every(6).hours.do(run_scraper)
print('Scheduler started. Running every 6 hours.')
run_scraper() # Run immediately
while True:
schedule.run_pending()
time.sleep(60)
"
command: python scheduler.py
# platform: linux/arm64
depends_on:
- flat-scraper