Skip to content

Commit

Permalink
clean-up and correct the issue in JGLOBAL_CLEANUP
Browse files Browse the repository at this point in the history
  • Loading branch information
aerorahul committed Jul 30, 2024
1 parent eed8604 commit b1e6dbb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
6 changes: 3 additions & 3 deletions jobs/JGLOBAL_CLEANUP
Original file line number Diff line number Diff line change
Expand Up @@ -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

19 changes: 4 additions & 15 deletions scripts/exglobal_cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit b1e6dbb

Please sign in to comment.