File indexing completed on 2026-04-09 07:49:03
0001
0002 usage(){ cat << EOU
0003 tmpgrab.sh : rsync between remote P:FOLD/EXECUTABLE and local FOLD/EXECUTABLE where FOLD is typically within /tmp/$USER/opticks
0004 ===================================================================================================================================
0005
0006 Notice that the entire tmpgrab.sh approach is only appropriate for early simple geometry tests.
0007 Once a geometry has matured it it much better to use cachegrab.sh in order to keep
0008 the geometry CSGFoundry together with results obtained from the geometry.
0009
0010 This script is intended to be used via controller scripts such as CSGOptiX/cxs_raindrop.sh
0011 which define the FOLD envvar and then sources this script in order to grab
0012 outputs from remote nodes::
0013
0014 EXECUTABLE=CXRaindropTest source tmpgrab.sh grab
0015
0016 This cherry picks from the old tmp_grab.sh while following the sourced approach of cachegrab.sh
0017
0018
0019 EOU
0020 }
0021
0022 tmpgrab_msg="=== $BASH_SOURCE :"
0023 tmpgrab_arg=${1:-grab}
0024
0025 echo $tmpgrab_msg tmpgrab_arg $tmpgrab_arg
0026
0027 shift
0028
0029 xbase=$FOLD
0030 xdir=$xbase/$EXECUTABLE/
0031
0032 from=P:$xdir
0033 to=$xdir
0034
0035 tmpgrab_vars="tmpgrab_arg EXECUTABLE FOLD xdir from to"
0036 tmpgrab_dumpvars(){ for var in $tmpgrab_vars ; do printf "%-30s : %s \n" $var "${!var}" ; done ; }
0037 tmpgrab_dumpvars
0038
0039
0040 if [ "${tmpgrab_arg}" == "grab" -o "${tmpgrab_arg}" == "graby" ]; then
0041 case ${tmpgrab_arg} in
0042 grab) read -p "$tmpgrab_msg Enter YES to proceed with rsync between from and to " ans ;;
0043 graby) ans="YES" ;;
0044 esac
0045 if [ "$ans" == "YES" ]; then
0046 echo $tmpgrab_msg proceeding
0047 mkdir -p $to
0048 rsync -zarv --progress --include="*/" --include="*.txt" --include="*.npy" --include="*.jpg" --include="*.mp4" --include "*.json" --exclude="*" "$from" "$to"
0049 ls -1rt `find ${to%/} -name '*.json' -o -name '*.txt' `
0050 ls -1rt `find ${to%/} -name '*.jpg' -o -name '*.mp4' -o -name '*.npy' `
0051 else
0052 echo $tmpgrab_msg skipping
0053 fi
0054 fi
0055
0056