From 3daa22ed05dfc70ee2dac8ef5cd7c73656de28b3 Mon Sep 17 00:00:00 2001 From: "Edward.Safford" Date: Fri, 31 Jan 2025 21:15:16 +0000 Subject: [PATCH] Ref #162 Add transfer_html.sh and plug it into the install scripts. --- .../image_gen/html/install_glb.sh | 23 +++++---- .../image_gen/html/install_rgn.sh | 5 ++ .../image_gen/html/transfer_html.sh | 50 +++++++++++++++++++ .../image_gen/ush/RadMon_IG_rgn.sh | 1 - .../image_gen/ush/transfer.sh | 11 ++-- 5 files changed, 75 insertions(+), 15 deletions(-) create mode 100755 src/Radiance_Monitor/image_gen/html/transfer_html.sh diff --git a/src/Radiance_Monitor/image_gen/html/install_glb.sh b/src/Radiance_Monitor/image_gen/html/install_glb.sh index cdd20f9a..23ac7e5f 100755 --- a/src/Radiance_Monitor/image_gen/html/install_glb.sh +++ b/src/Radiance_Monitor/image_gen/html/install_glb.sh @@ -10,9 +10,7 @@ #-------------------------------------------------------------------- #-------------------------------------------------------------------- -echo "BEGIN install_glb.sh" -echo "" -echo "" +echo "BEGIN install_glb.sh"; echo; echo do_cmp=0 cmp_src="" @@ -23,7 +21,7 @@ cmp_src="" # echo "Do you wish to enable data plots to include comparison to" echo " operational GDAS data, or another data source?" -echo "" +echo echo -n " Enter YES to enable comparison plots, any other input to disable. > " read text short=`echo $text | cut -c1` @@ -35,7 +33,7 @@ if [[ $short = "Y" || $short = "y" ]]; then echo "Please specify the suffix of your comparison data source," echo " or just hit the return key to use the operational GDAS as " echo " the comparison source" - echo "" + echo echo -n " > " read text @@ -80,7 +78,6 @@ fi PDATE=`${MON_USH}/find_last_cycle.sh --net ${RADMON_SUFFIX} \ --run ${RUN} --mon radmon --tank ${R_TANKDIR}` -echo PDATE=$PDATE limit=`$NDATE -120 $PDATE` # 5 days @@ -90,7 +87,7 @@ limit=`$NDATE -120 $PDATE` # 5 days data_found=0 while [[ data_found -eq 0 && $PDATE -ge $limit ]]; do - + ieee_src=`${MON_USH}/get_stats_path.sh --run $RUN --pdate ${PDATE} \ --net ${RADMON_SUFFIX} --tank ${R_TANKDIR} --mon radmon` @@ -123,8 +120,8 @@ while [[ data_found -eq 0 && $PDATE -ge $limit ]]; do done if [[ $data_found -eq 0 ]]; then - echo Unable to locate any data files in the past 5 days for $SUFFIX - echo in $TANKverf/angle. + echo Unable to locate any data files in the 5 days from ${PDATE} + echo for ${SUFFIX} in ${TANKverf}/angle. exit fi @@ -386,6 +383,11 @@ for file in $arrow_files; do $NCP ${RADMON_IMAGE_GEN}/html/${file} ${imgndir}/pngs/. done +#--------------------------- +# transfer files to server +# +${RADMON_IMAGE_GEN}/html/transfer_html.sh + #------------------------ # clean up $workdir # @@ -393,7 +395,6 @@ cd $workdir cd ../ rm -rf $workdir -echo "" -echo "END install_glb.sh" +echo; echo "END install_glb.sh" exit diff --git a/src/Radiance_Monitor/image_gen/html/install_rgn.sh b/src/Radiance_Monitor/image_gen/html/install_rgn.sh index 403fca92..596b34d0 100755 --- a/src/Radiance_Monitor/image_gen/html/install_rgn.sh +++ b/src/Radiance_Monitor/image_gen/html/install_rgn.sh @@ -396,6 +396,11 @@ for file in $arrow_files; do $NCP ${RADMON_IMAGE_GEN}/html/${file} ${imgndir}/pngs/. done +#--------------------------- +# transfer files to server +# +${RADMON_IMAGE_GEN}/html/transfer_html.sh + #------------------------ # clean up $workdir # diff --git a/src/Radiance_Monitor/image_gen/html/transfer_html.sh b/src/Radiance_Monitor/image_gen/html/transfer_html.sh new file mode 100755 index 00000000..2bc46337 --- /dev/null +++ b/src/Radiance_Monitor/image_gen/html/transfer_html.sh @@ -0,0 +1,50 @@ +#!/usr/bin/bash + +echo; echo " -----------------------------"; echo + +echo "All html and web support files have been created."; echo +echo "Do you wish to transfer these files to the webserver now?"; echo + +echo -n " Enter YES to transfer now, any other input to decline. > " +read text +short=`echo $text | cut -c1` + +if [[ $short = "Y" || $short = "y" ]]; then + + echo; echo + echo "Submitting transfer job" + + if [[ ! -d ${R_LOGDIR} ]]; then + mkdir -p ${R_LOGDIR} + fi + + transfer_log=${R_LOGDIR}/Transfer_${RADMON_SUFFIX}.log + if [[ -e ${transfer_log} ]]; then + rm ${transfer_log} + fi + + transfer_err=${R_LOGDIR}/Transfer_${RADMON_SUFFIX}.err + if [[ -e ${transfer_err} ]]; then + rm ${transfer_err} + fi + + transfer_queue=dev_transfer + jobname=transfer_${RADMON_SUFFIX} + + if [[ $RAD_AREA == 'glb' ]]; then + export WEBDIR=${WEBDIR}/${RADMON_SUFFIX} + else + export WEBDIR=${WEBDIR}/regional/${RADMON_SUFFIX} + fi + + cmdfile="./transfer_cmd" + echo "${IG_SCRIPTS}/transfer.sh" >$cmdfile + chmod 755 $cmdfile + + $SUB -q $transfer_queue -A $ACCOUNT -o ${transfer_log} -e ${transfer_err} \ + -v "INCLUDE_PNGS=1, WEBSVR=${WEBSVR}, WEBUSER=${WEBUSER}, \ + WEBDIR=${WEBDIR}, TANKimg=${TANKimg}" \ + -l select=1:mem=500M -l walltime=30:00 -N ${jobname} ${cmdfile} + +fi + diff --git a/src/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh b/src/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh index 75beedd9..95664596 100755 --- a/src/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh +++ b/src/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh @@ -262,7 +262,6 @@ if [[ $RUN_TRANSFER -eq 1 ]]; then transfer_queue=dev_transfer jobname=transfer_${RADMON_SUFFIX} - job="${IG_SCRIPTS}/Transfer.sh --nosrc ${RADMON_SUFFIX}" export WEBDIR=${WEBDIR}/regional/${RADMON_SUFFIX} diff --git a/src/Radiance_Monitor/image_gen/ush/transfer.sh b/src/Radiance_Monitor/image_gen/ush/transfer.sh index 9957cb47..1e768659 100755 --- a/src/Radiance_Monitor/image_gen/ush/transfer.sh +++ b/src/Radiance_Monitor/image_gen/ush/transfer.sh @@ -2,6 +2,12 @@ if [[ ${TANKimg} != "/" && -d ${TANKimg} ]]; then + if [[ ${INCLUDE_PNGS} == 1 ]]; then + exclude="--exclude 'horiz'" + else + exclude="--exclude 'horiz' --exclude '*.png'" + fi + WEBSVR=${WEBSVR}.ncep.noaa.gov #---------------------------------------------------------- @@ -24,9 +30,8 @@ if [[ ${TANKimg} != "/" && -d ${TANKimg} ]]; then ssh ${WEBUSER}@${WEBSVR} "mkdir -p ${WEBDIR}" fi - /usr/bin/rsync -ave ssh --exclude *.ctl.${Z} \ - --exclude 'horiz' --exclude '*.png' --delete-during --update ${TANKimg}/ \ - ${WEBUSER}@${WEBSVR}:${WEBDIR}/ + /usr/bin/rsync -ave ssh --exclude *.ctl.${Z} ${exclude} \ + --delete-during --update ${TANKimg}/ ${WEBUSER}@${WEBSVR}:${WEBDIR}/ else echo "Unable to run rsync, TANKimg has bad/no value of: ${TANKimg}"