Commit 7ccf886f authored by Juve, Gideon's avatar Juve, Gideon
Browse files

Add error checking to acme.sh

parent 63379819
#!/bin/bash
set -e
function usage () {
echo "Usage: $0 -stop STOP_OPTION -n STOP_N -run RUN"
echo "Usage: $0 [-continue] -stage N -stop STOP_OPTION -n STOP_N -run RUN"
}
if [ "$#" == "0" ]; then
......@@ -9,11 +11,14 @@ if [ "$#" == "0" ]; then
exit 1
fi
CONTINUE_RUN=FALSE
while [ "$#" -ne 0 ]; do
case "$1" in
-case)
shift
CASE=$1
-continue)
CONTINUE_RUN=TRUE
;;
-stage)
STAGE=$1
;;
-stop)
shift
......@@ -23,10 +28,6 @@ while [ "$#" -ne 0 ]; do
shift
STOP_N=$1
;;
-run)
shift
RUN=$1
;;
*)
usage
exit 1
......@@ -35,21 +36,48 @@ while [ "$#" -ne 0 ]; do
shift
done
echo RUN $RUN
echo STOP_N $STOP_N
echo STOP_OPTION $STOP_OPTION
echo CONTINUE_RUN $CONTINUE_RUN
echo STAGE $STAGE
exit 0
if [ -z "$STAGE" ]; then
echo "ERROR: Specify -stage"
usage
exit 1
fi
cd $PBS_O_WORKDIR
if [ -z "$STOP_N" ]; then
echo "ERROR: Specify -n"
usage
exit 1
fi
CASE=$(./xmlquery CASE -valonly -silent)
if [ -z "$STOP_OPTION" ]; then
echo "ERROR: Specify -stop"
usage
exit 1
fi
./xmlchange -file env_run.xml -id RUNDIR -val $PWD/$RUN
./xmlchange -file env_run.xml -id STOP_N -val $STOP_N
./xmlchange -file env_run.xml -id STOP_OPTION -val $STOP_OPTION
if ! [ -z "$PBS_O_WORKDIR" ]; then
cd $PBS_O_WORKDIR
fi
# We never want to resubmit the jobs in the Pegasus workflow
./xmlchange -file env_run.xml -id RESUBMIT -val 0
./xmlchange -file env_run.xml -id DOUT_S_ROOT -val \$CASEROOT/archive
# Only continue for stage > 1
./xmlchange -file env_run.xml -id CONTINUE_RUN -val $CONTINUE_RUN
# Set the interval
./xmlchange -file env_run.xml -id STOP_OPTION -val $STOP_OPTION
./xmlchange -file env_run.xml -id STOP_N -val $STOP_N
# We might need to change these
#./xmlchange -file env_run.xml -id RUNDIR -val $PWD/$RUN
#./xmlchange -file env_run.xml -id DOUT_S_ROOT -val \$CASEROOT/archive
# Get the case name and invoke the script
CASE=$(./xmlquery CASE -valonly -silent)
exec $CASE.run
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment