#!/bin/bash err () { errorCode=$? # save the exit code as the first thing done in the trap function echo "error $errorCode" echo "the command executing at the time of the error was" echo "$BASH_COMMAND" echo "on line ${BASH_LINENO[0]}" # do some error handling, cleanup, logging, notification # $BASH_COMMAND contains the command that was being executed at the time of the trap # ${BASH_LINENO[0]} contains the line number in the script of that command # exit the script or return to try again, etc. exit $errorCode # or use some other value or do return instead } # # if we start using this the log on the trap is worse, but that's not so bad since the log # of the process will print the error. MAX_JOBS=2 my_parallel () { scripts=$@ TOTAL_JOBS=$# for script in ${scripts[@]} do echo $script slash="/" log_dir="${script//$slash/_}" log_dir="${log_dir%.*}" seq 1 $TOTAL_JOBS | xargs -P $MAX_JOBS -I{} sh -c "$script &> $log_dir" done } trap err SIGINT SIGTERM ERR CHLD #bash Config/Projects/AIT_ABI_EN/Examples/run-GOES17-FD-Day.bash &> LOG_example-GOES17-FD-Day.log #my_parallel run-WINDS_UNIT.bash run-GOES16-FD-Day.bash #wait #exit bash Config/Projects/AIT_ABI_EN/Examples/run-GOES16.bash &> LOG_example-GOES16.log bash Config/Projects/AIT_ABI_EN/Examples/run-WINDS_UNIT.bash &> LOG_example-WINDS_UNIT.log bash Config/Projects/AIT_ABI_EN/Examples/run-GOES17.bash &> LOG_example-GOES17.log bash Config/Projects/AIT_AHI_EN/Examples/run-AHI.bash &> LOG_example-AHI.log bash Config/Projects/AIT_AHI_EN/Examples/run-WINDS_UNIT.bash &> LOG_example-AHI-WINDS_UNIT.log #bash Config/Projects/EPS_GEO/run-MET11-parallel.bash &> LOG_example-MET11.log bash Config/Projects/AIT_AVHRR/Examples/run-AVHRR-GHRR.bash &> LOG_example-run-AVHRR-GHRR.log python Config/Projects/AIT_AVHRR/Examples/run_AVHRR_WindsTests.py &> LOG_example-run-AVHRR-Winds.log #bash Config/Projects/ECW/Test_Scripts/run-AVHRR-GHRR.bash #bash Config/Projects/ECW/Test_Scripts/run-Winds.bash python Config/Projects/AHI_RR/Test_Scripts/run-RR_PARALLAX.py &> LOG_example-AHI-RR-PARALLAX.log #python Config/Projects/AHI_RR/Test_Scripts/run-PARALLAX.py #python Config/Projects/AHI_RR/Test_Scripts/run-RR.py bash Config/Projects/AIT_VIIRS/Examples/run-NOAA20.bash &> LOG_example-NOAA20.log bash Config/Projects/AIT_VIIRS/Examples/run-NPP.bash &> LOG_example-NPP.log bash Config/Projects/AIT_VIIRS/Examples/run-Winds.bash &> LOG_example-Winds.log #bash Config/Projects/JRR/Test_Scripts/run-NOAA20_VIIRS_DAY.bash&> run-JRR-NOAA20-Day.log #bash Config/Projects/JRR/Test_Scripts/run-NPP_VIIRS_DAY.bash&> run-JRR-NPP-Day.log #bash Config/Projects/JRR/Test_Scripts/run-NPP_VIIRS_NIGHT.bash &> run-JRR-NPP-NIGHT.log #bash Config/Projects/JRR/Test_Scripts/run-Winds.bash &> run-JRR-Winds.log #./Config/Projects/GFLS/Test_Scripts/run-ONE_UNIT-G17.bash #./Config/Projects/GFLS/Test_Scripts/run-FOG_UNIT.bash #./Config/Projects/GFLS/Test_Scripts/run-ONE_UNIT-G16.bash #./Config/Projects/GFLS/Test_Scripts/run-ASOS_CLOUD_UNIT.bash #./Config/Projects/GFLS/Test_Scripts/run-ONE_UNIT.bash #Config/Sample_Configurations/RADBUD_SRB_EN-Temporal/run-GOESR_ABI_SRB-Temporal-parallel.bash #bash Config/Projects/ABI_PRO/Test_Scripts/run-SOUNDING_UNIT.bash #bash Config/Projects/ACSPO_L2C/Test_Scripts/run-GOES17.bash #bash Config/Projects/ACSPO_L2C/Test_Scripts/run-GOES16.bash #bash Config/Projects/ACSPO_L2P/Test_Scripts/run-GOES17.bash #bash Config/Projects/ACSPO_L2P/Test_Scripts/run-GOES16.bash #bash Config/Projects/ABI_RR/Test_Scripts/run-GOES16.py #bash Config/Projects/ABI_RR/Test_Scripts/run-GOES17.py #bash Config/Algorithms/Test/Test1/run_framework_p1.sh #bash Config/Algorithms/Test/Test1/run_framework_p3.sh #bash Config/Algorithms/Test/Test1/run_framework_p2.sh #bash Config/Algorithms/Test/Test_Temporal/run_test_C.sh #bash Config/Algorithms/Test/Test_Temporal/run_dynamic_time_offsets.sh wait