#!/bin/bash ################################################################## # Descriptions: This job clean up the working directories # 9/20/2009, Julia Zhu Scripts are modified to be sharable # between EMC and NCO # Please note that variable "RUN_ENVIR" is set and used # in the development enviroment only. # ################################################################## set -xa # # Specify whether the run is production or development # export RUN_ENVIR=${RUN_ENVIR:-nco} ##################################################################################### # Run config file to get input parameters # This config file should define the following variables # DATA_IN: Location of working directory, default to ${DATAROOT} # DEV_SMS: If the job is to be running using SMS, default to YES # SENDDBN: Set to NO for developers, default to YES # COM_IN: Directory for input files, default to ${COMROOT}/$NET/${envir} # COM_OUT: Directory for output file, default to ${COMROOT}/$NET/${envir} # gespath: Directory for the guess or restart files, default to ${GESROOT}/${envir} ##################################################################################### echo `date` $0 `date -u` begin export PS4='$SECONDS + ' # ################################### # SET SHELL PROCESSING VARIABLES # ################################### export PS4='$SECONDS + ' date ########################################################### # obtain unique process id (pid) and make temp directories ########################################################### export DATA_IN=${DATA_IN:-${DATAROOT}} export DATA=$DATA_IN/${jobid:?} rm -rf $DATA mkdir -p $DATA cd $DATA #################################### # File To Log Msgs #################################### export jlogfile=${jlogfile:-$DATA/jlogfile.${job}.$$} #################################### # Determine Job Output Name on System #################################### export pgmout="OUTPUT.$$" export FLENGTH=87 export CYC=${cyc} export cycle=t${cyc}z ############################### # Specify NET and RUN name ############################## export NET=sref export RUN=sref ################################################## # SAVEGES - Copy Files From TMPDIR to $GESdir # SENDSMS - Flag Events on ecFlow # SENDCOM - Copy Files From TMPDIR to $COMOUT # SENDDBN - Issue DBNet Client Calls # RERUN - Rerun fcst from beginning (default no) ################################################## export SENDCOM=${SENDCOM:-YES} export SENDECF=${SENDECF:-YES} export SENDDBN=${SENDDBN:-YES} export HOMEsref=${HOMEsref:-${PACKAGEROOT}/${NET}.${sref_ver}} export EXECsref=${EXECsref:-$HOMEsref/exec} export FIXsref=${FIXsref:-$HOMEsref/fix} export PARMsref=${PARMsref:-$HOMEsref/parm} export USHsref=${USHsref:-$HOMEsref/ush} # Run setpdy and initialize PDY variables setpdy.sh . ./PDY env ######################################################## # Start remove the directories ######################################################## for mod in ARW NMB do rm -rf $DATA_IN/sref_gfsprep_${cyc}_${envir} rm -rf $DATA_IN/sref_${mod}_wps_${cyc}_${envir} rm -rf $DATA_IN/sref_${mod}_real_${cyc}_${envir} rm -rf $DATA_IN/sref_${mod}_fcst_${cyc}_${envir} rm -rf $DATA_IN/sref_${mod}_post*_${cyc}_${envir} rm -rf $DATA_IN/sref_${mod}_bufr_${cyc}_${envir} done cd $DATA_IN if [ ${KEEPDATA:-NO} != YES ] ; then rm -rf $DATA ; fi msg="JOB $job HAS COMPLETED NORMALLY." postmsg $jlogfile "$msg" date