diff --git a/build.sh b/build.sh index 6233aa00..91a66632 100755 --- a/build.sh +++ b/build.sh @@ -101,3 +101,32 @@ if ! echo "$cc"|grep -Fq "fetch_forex_rates"; then else echo "汇率任务已存在,未重复添加。" fi + +# sage_datamart ETL crontab +cc=$(crontab -l 2>/dev/null) + +# 每5分钟增量同步 llmusage → dm_model_call_fact +dm_sync_cron="*/5 * * * * curl -s http://localhost:9180/sage_datamart/cron/etl_sync.dspy" +if ! echo "$cc"|grep -Fq "etl_sync"; then + (echo "$cc";echo "$dm_sync_cron") | crontab - + cc=$(crontab -l 2>/dev/null) +else + echo "datamart sync任务已存在,未重复添加。" +fi + +# 每小时聚合 dm_model_perf_daily +dm_agg_cron="15 * * * * curl -s http://localhost:9180/sage_datamart/cron/etl_aggregate.dspy" +if ! echo "$cc"|grep -Fq "etl_aggregate"; then + (echo "$cc";echo "$dm_agg_cron") | crontab - + cc=$(crontab -l 2>/dev/null) +else + echo "datamart aggregate任务已存在,未重复添加。" +fi + +# 每天 02:00 聚合供应商性价比 +dm_prov_cron="0 2 * * * curl -s http://localhost:9180/sage_datamart/cron/etl_provider_cost.dspy" +if ! echo "$cc"|grep -Fq "etl_provider_cost"; then + (echo "$cc";echo "$dm_prov_cron") | crontab - +else + echo "datamart provider_cost任务已存在,未重复添加。" +fi