diff --git a/jobs/JGLOBAL_CLEANUP b/jobs/JGLOBAL_CLEANUP index 2f81003989..f3cfcae511 100755 --- a/jobs/JGLOBAL_CLEANUP +++ b/jobs/JGLOBAL_CLEANUP @@ -5,13 +5,13 @@ source "${HOMEgfs}/ush/jjob_header.sh" -e "cleanup" -c "base cleanup" "${SCRgfs}/exglobal_cleanup.sh" status=$? -[[ ${status} -ne 0 ]] && exit "${status}" +(( status != 0 )) && exit "${status}" ########################################## # Remove the Temporary working directory ########################################## -cd "${DATAROOT}" || (echo "${DATAROOT} does not exist. ABORT!"; exit 1) -[[ ${KEEPDATA} = "NO" ]] && rm -rf "${DATA}" +# DATAROOT="${STMP}/RUNDIRS/${PSLOT}/${RUN}.${PDY}${cyc}" +# is removed in exglobal_cleanup.sh, nothing to do here. exit 0 diff --git a/scripts/exglobal_cleanup.sh b/scripts/exglobal_cleanup.sh index bc0816f3d6..75b1f927bc 100755 --- a/scripts/exglobal_cleanup.sh +++ b/scripts/exglobal_cleanup.sh @@ -21,28 +21,17 @@ rm -rf "${DATAROOT}" echo "Cleanup ${DATAROOT} completed!" ############################################################### -############################################################### -# Clean up previous cycles; various depths -# PRIOR CYCLE: Leave the prior cycle alone -# shellcheck disable=SC2153 -GDATE=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} -${assim_freq} hours") -# PREVIOUS to the PRIOR CYCLE -GDATE=$(date --utc +%Y%m%d%H -d "${GDATE:0:8} ${GDATE:8:2} -${assim_freq} hours") - -# Remove the TMPDIR directory -# TODO Only prepbufr is currently using this directory, and all jobs should be -# cleaning up after themselves anyway -COMIN="${DATAROOT}/${GDATE}" -[[ -d ${COMIN} ]] && rm -rf "${COMIN}" - if [[ "${CLEANUP_COM:-YES}" == NO ]] ; then exit 0 fi +############################################################### +# Clean up previous cycles; various depths + # Step back every assim_freq hours and remove old rotating directories # for successful cycles (defaults from 24h to 120h). # Retain files needed by Fit2Obs -last_date=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} -${RMOLDEND:-24} hours" ) +last_date=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} -${RMOLDEND:-24} hours") first_date=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} -${RMOLDSTD:-120} hours") last_rtofs=$(date --utc +%Y%m%d%H -d "${PDY} ${cyc} -${RMOLDRTOFS:-48} hours") function remove_files() {