diff --git a/src/nectarchain/user_scripts/jlenain/dqm_job_submitter/dqm_processor.sh b/src/nectarchain/user_scripts/jlenain/dqm_job_submitter/dqm_processor.sh index ba0d915e..ae2cf3a6 100755 --- a/src/nectarchain/user_scripts/jlenain/dqm_job_submitter/dqm_processor.sh +++ b/src/nectarchain/user_scripts/jlenain/dqm_job_submitter/dqm_processor.sh @@ -5,7 +5,7 @@ function usage () { - echo "Usage: $(basename $0) -r " + echo "Usage: $(basename "$0") -r " } function help () @@ -36,7 +36,7 @@ while getopts ":hr:" option; do done shift $((OPTIND-1)) -if [ -z $runnb ]; then +if [ -z "$runnb" ]; then usage exit 1 fi @@ -55,18 +55,18 @@ function exit_script() { # Some cleanup before leaving: # [ -d $CONTAINER ] && rm -rf $CONTAINER # [ -f $CONTAINER ] && rm -f $CONTAINER - [ -d $NECTARCAMDATA ] && rm -rf $NECTARCAMDATA - [ -d $OUTDIR ] && rm -rf $OUTDIR - [ -f ${OUTDIR}.tar.gz ] && rm -f ${OUTDIR}.tar.gz - [ -d ${OUTDIR} ] && rm -rf ${OUTDIR} + [ -d "$NECTARCAMDATA/runs" ] && rm -rf "$NECTARCAMDATA/runs" + [ -d "$OUTDIR" ] && rm -rf "$OUTDIR" + [ -f "${OUTDIR}.tar.gz" ] && rm -f "${OUTDIR}.tar.gz" + [ -d "${OUTDIR}" ] && rm -rf "${OUTDIR}" [ -f $WRAPPER ] && rm -f $WRAPPER - exit $return_code + exit "$return_code" } -export NECTARCAMDATA=$PWD/runs -[ ! -d $NECTARCAMDATA ] && mkdir -p $NECTARCAMDATA || exit_script $? -mv nectarcam*.sqlite NectarCAM.Run*.fits.fz $NECTARCAMDATA/. +export NECTARCAMDATA=$PWD +[ ! -d "$NECTARCAMDATA/runs" ] && mkdir -p "$NECTARCAMDATA/runs" || exit_script $? +mv nectarcam*.sqlite NectarCAM.Run*.fits.fz "$NECTARCAMDATA/runs/." # Halim's DQM code needs to use a specific output directory: export NECTARDIR=$PWD/$OUTDIR @@ -79,22 +79,19 @@ export NECTARDIR=$PWD/$OUTDIR # Create a wrapper BASH script with cleaned environment, see https://redmine.cta-observatory.org/issues/51483 cat > $WRAPPER <