#!/bin/sh # Standard job for transferring directories between the production # NOAA/NWS/NCEP Weather and Climate Operational Supercomputer Systems and # websites hosted on RZDM. # # 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. It defaults to # ${HOMEtransfers}/parm/transfer_rzdm_${RUN}.list # # * CPUS can be set as an ecFlow variable 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 # HMU added logic in here that will use a PARALLEL parm list # that is activated during a parallel production test # This parm list transfers data to an alternate directory on rzdm # Determine which directories/files to transfer if [[ ${RUN:?} =~ ^nwprod_* ]]; then # Generate the appropriate transfer list file in the $DATA directory from the template TRANSFER_TEMPLATE=${TRANSFER_LIST:-$PARMtransfers/transfer_rzdm_nwprod.list} export TRANSFER_LIST=$DATA/transfer_rzdm_${RUN}.list export NWROOTlib=$NWROOThps # Post lib directory from Cray XC40 export NWROOTdecoders=$NWROOTp3 # Post decoders directory from Phase 3 perl $USHtransfers/get_package_versions.pl $TRANSFER_TEMPLATE $TRANSFER_LIST elif [[ ${RUN:?} == "rtdm" ]]; then #Check the PARATEST variable to see if we are running a parallel production test #And use the appropriate parm file that says where to send the data if [[ "$PARATEST" == "YES" ]];then echo "Parallel Production Test is Running changing the parm file" export TRANSFER_LIST=${HOMErtdm}/parm/transfer_rzdm_${RUN}_PARALLEL.list echo "The parm file is now $TRANSFER_LIST" else export TRANSFER_LIST=${TRANSFER_LIST:-$PARMtransfers/transfer_rzdm_${RUN}.list} fi else export TRANSFER_LIST=${TRANSFER_LIST:-$PARMtransfers/transfer_rzdm_${RUN}.list} fi ############################################################# # execute the script ${HOMEtransfers}/scripts/extransfer_rzdm.sh "ncorzdm.ncep.noaa.gov" "RZDM" export err=$?; err_chk ############################################################# ############################################################# if [[ ${RUN:?} = "nwprod_cleanup" ]]; then echo "clean up /home/people/nco/www/htdocs/pmb/codes/nwpara and nwtest ..." ssh ncorzdm.ncep.noaa.gov " du -sh /home/people/nco/www/htdocs/pmb/codes/nwpara/" ssh ncorzdm.ncep.noaa.gov " du -sh /home/people/nco/www/htdocs/pmb/codes/nwtest/" ssh ncorzdm.ncep.noaa.gov " rm -rf /home/people/nco/www/htdocs/pmb/codes/nwpara/*" ssh ncorzdm.ncep.noaa.gov " rm -rf /home/people/nco/www/htdocs/pmb/codes/nwtest/*" fi postmsg "$jlogfile" "$0 completed normally" ######################################## # Remove the Temporary working directory ######################################## if [[ $KEEPDATA != "YES" ]]; then rm -rf $DATA fi date