154f871dec4299c79113834fd45f17a4521ad8c6
jcasper
  Wed Nov 23 22:07:55 2022 -0800
Replacing lockfile in fetchCramReference with flock, to remove the procmail
dependency.  Also updating the browserbox version to match the current server version.  refs #17547, #14717

diff --git src/product/scripts/fetchCramReference.sh src/product/scripts/fetchCramReference.sh
index 9b66c52..ed36df3 100755
--- src/product/scripts/fetchCramReference.sh
+++ src/product/scripts/fetchCramReference.sh
@@ -43,36 +43,32 @@
     exit 255
 fi
 
 if [ ! -d "$DESTDIR" ]
 then
     echo "Error: $DESTDIR is missing or not a directory"
     exit 255
 fi
 
 if [ ! -d "$ERRORDIR" ]
 then
     echo "Error: $ERRORDIR is missing or not a directory"
     exit 255
 fi
 
-if lockfile -! -r 0 "${PENDING}/fetch.lock" >& /dev/null
-then
-    # echo "${PENDING}/fetch.lock already exists.  Exiting."
-    exit 0
-fi
-
+(
+flock -n 9 || exit 0
 
 # set up cleanup in the event of Ctrl-C
 trap '{rm -f "${PENDING}/*.out"; rm -f ${PENDING}/fetch.lock; exit 1; }' INT
 
 
 # Re-add files that previously failed, if they failed long enough ago.
 # Retry after 1 hour; give up after $MAXTRIES attempts
 find ${ERRORDIR} -type f -mmin +60 -printf "%f\0" |
  xargs -0 -n 1 -I % sh -c \
 '
     if [ -e "${PENDING}/%.try${MAXTRIES}" ]
     then
         rm -f "${PENDING}/%.try${MAXTRIES}" "${ERRORDIR}/%"
     else
         cp $(find "${PENDING}" -maxdepth 1 -type f -name "%.try*" -print -quit) "${PENDING}/%" || true
@@ -100,17 +96,16 @@
     # On error, increment try count
     if [ -e "${ERRORDIR}/%" ]
     then
         OLDTRY=$(find "${PENDING}" -maxdepth 1 -type f -name "%.try*" -print -quit)
         if [[ "${OLDTRY}" == "" ]]
         then
             mv "${PENDING}/%" "${PENDING}/%.try1"
         else
             NEWTRY=$(echo "${OLDTRY}" | perl -pe "s/try(\d+)$/\"try\".(\$1+1)/e" )
             mv "${OLDTRY}" "${NEWTRY}"
             rm -f "${PENDING}/%"
         fi
         rm -f "${PENDING}/%.out"
     fi
 '
-
-rm -f "${PENDING}/fetch.lock"
+) 9>${PENDING}/fetch.lock