#!/bin/bash
##
## run_eod.sh - 일마감(EOD): 집계 배치 일괄 실행.
## 운영 스크립트: Enduro/X + ECPG/XA 런타임 환경을 설정하고 배치/서비스를 실행.
##   Usage: run_eod.sh [BIZDATE] [MERCH] [AMOUNT] [PID]
##
set -e
. /app/conf/setapp.sh

BIZDATE="${1:-2026-07-19}"
MERCH="${2:-M0001}"
AMOUNT="${3:-1000000}"
PID="${4:-1}"

echo "[run_eod.sh] BIZDATE=$BIZDATE MERCH=$MERCH AMOUNT=$AMOUNT"
for b in ac_daily_batch ac_merchsum_batch ac_wht_batch ac_settle_batch \
         ac_cancel_batch ac_fx_batch ac_taxinv_batch ac_feeadj_batch; do
    echo "--- $b $BIZDATE ---"
    "/app/bin/$b" "$BIZDATE" || exit 1
done
