#!/bin/sh # Standard job for transferring directories between the production # NOAA/NWS/NCEP Weather and Climate Operational Supercomputer Systems and # development RDHPCS systems. # # The following environment variables will be used by the job if set: # # HOMEtransfers, DATA, COMROOT, RUN, SENDCOM, SENDECF, KEEPDATA, # # RSYNC_MAX_SECONDS: Maximum IO timout of each rsync connection (default 300) # RSYNC_MAX_ATTEMPTS: Number of times to attempt each rsync (default 3) # RSYNC_OPTIONS: A string of additional rsync command-line parameters # RSYNC_DEST_ROOT: If defined, will be prepended to all destination # directory paths. This is mainly used for testing. # TRANSFER_LIST: A file containing a list of directories and optional # include/exclude patterns. # If the PACKAGE* ecFlow variable is set, TRANSFER_LIST is # ${HOME%PACKAGE%}/parm/transfer_rdhpcs_${RUN}.list # Otherwise, it defaults to # ${HOMEtransfers}/parm/transfer_rdhpcs_${RUN}.list # # * PACKAGE and CPUS can be set as ecFlow variables date export PS4=' $SECONDS + ' set -x export DATA=${DATA:-${DATAROOT:?}/${jobid:?}} mkdir -p $DATA cd $DATA export jlogfile=${jlogfile:-${DATA}/jlogfile.${jobid}} export cycle=${cycle:-t${cyc}z} setpdy.sh 10 1 . ./PDY export MONCUR=${PDY:0:6} export MONPREV=$(date -d "$PDY -1 month" +%Y%m) export YEARCUR=${PDY:0:4} export YEARPREV=$(date -d "$PDY -1 year" +%Y) export SENDCOM=${SENDCOM:-NO} export SENDECF=${SENDECF:-YES} export PARMtransfers=${HOMEtransfers:?}/parm export FIXtransfers=${HOMEtransfers:?}/fix export USHtransfers=${HOMEtransfers:?}/ush # Establish rsync timeout and retry limits export RSYNC_MAX_SECONDS=${RSYNC_MAX_SECONDS:-300} export RSYNC_MAX_ATTEMPTS=${RSYNC_MAX_ATTEMPTS:-3} # Transfers to RDHPCS will always be pushed out export RSYNC_DIRECTION=PUSH # Determine which directories/files to transfer export TRANSFER_LIST=${TRANSFER_LIST:-$PARMtransfers/transfer_rdhpcs_${RUN:?}.list} if [ ! -f $TRANSFER_LIST ] then echo "$TRANSFER_LIST not exist, check the transfer subdirectory!" dir=`dirname $TRANSFER_LIST` fileName=`basename $TRANSFER_LIST` TRANSFER_LIST=${dir}/transfer/${fileName} fi ecfID=$(echo ${PBS_JOBID} | awk -F"." '{print $1}') export OUTPUTFILE=${PBS_OUTPUTFILE:-${PBS_O_WORKDIR}/${PBS_JOBNAME}.o${ecfID}} export stdout_file=$(readlink -m $OUTPUTFILE) ############################################################# # execute the script # HMU Changed Theia to Hera since Hera is replacing Theia if [[ ${RUN:?} =~ ^canned_* ]]; then ${HOMEtransfers}/scripts/extransfer_canned.sh "role.nwprod@dtn-hera.fairmont.rdhpcs.noaa.gov" "Hera" else ${HOMEtransfers}/scripts/extransfer.sh "role.nwprod@dtn-hera.fairmont.rdhpcs.noaa.gov" "Hera" fi export err=$?; err_chk ############################################################# postmsg "$jlogfile" "$0 completed normally" ######################################## # Remove the Temporary working directory ######################################## if [[ $KEEPDATA != "YES" ]]; then rm -rf $DATA fi date