#/bin/bash
# A script that runs all of a day's wheat rust forecasts in order
# 1: depo
# 2: env
# 3: epi
# 4: advisory

echo "starting catchup"

config=$1 # /storage/app/EWS_prod/regions/EastAfrica/resources/coordinator/configs/config_EastAfrica_fc_live.json
date=$2 # 20221009

# depo
/storage/app/EWS_prod/code/coordinator/run_Processor.sh -p Deposition -c $config -s $date --clearup  &

# Wait at least a minute so that logfile timestamps do not clash
sleep 70

# env
/storage/app/EWS_prod/code/coordinator/run_Processor.sh -p Environment -c $config -s $date --clearup &

# wait for depo and env to finish
wait

# epi
/storage/app/EWS_prod/code/coordinator/run_Processor.sh -p Epidemiology -c $config -s $date --clearup &

# Wait at least a minute so that logfile timestamps do not clash
sleep 70

# advisory
/storage/app/EWS_prod/code/coordinator/run_Processor.sh -p Advisory -c $config -s $date --clearup &

wait

echo "finished catchup"
