diff --git a/daily_run.py b/daily_run.py new file mode 100644 index 0000000..d2556e9 --- /dev/null +++ b/daily_run.py @@ -0,0 +1,43 @@ +# ./lib/weather_asos.py +# ./lib/ga4.py +# ./lib/air_quality.py +# 각 파일을 모두 한번씩 실행 +# daily_run.py + +import os +import sys + +# lib 디렉토리를 path에 추가 +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib'))) +from conf import db, db_schema + +def run_weather(): + try: + from weather_asos import main as weather_main + print("\n[RUNNING] weather_asos.py") + weather_main() + except Exception as e: + print(f"[ERROR] weather_asos 실행 실패: {e}") + +def run_ga4(): + try: + from ga4 import main as ga4_main + print("\n[RUNNING] ga4.py") + ga4_main() + except Exception as e: + print(f"[ERROR] ga4 실행 실패: {e}") + +def run_air_quality(): + try: + from air_quality import AirQualityCollector + print("\n[RUNNING] air_quality.py") + config = db.load_config() + collector = AirQualityCollector(config, db.engine, db_schema.air) + collector.run() + except Exception as e: + print(f"[ERROR] air_quality 실행 실패: {e}") + +if __name__ == "__main__": + run_weather() + run_ga4() + run_air_quality()