1fbf0a4bf3e1a40b9a117893d61b395561779d7a
chmalee
  Mon Sep 23 13:45:20 2019 -0700
Adding archiving commands to otto build scripts, refs #21825

diff --git src/hg/utils/otto/geneReviews/checkGeneReviews.sh src/hg/utils/otto/geneReviews/checkGeneReviews.sh
index 53f6fb5..95f2da7 100755
--- src/hg/utils/otto/geneReviews/checkGeneReviews.sh
+++ src/hg/utils/otto/geneReviews/checkGeneReviews.sh
@@ -37,22 +37,39 @@
     today=`date +%F`
     mkdir -p $today
     mv *.txt $today
 
     cd $today
 
     # build the new GENEREVIEWS track tables
     ../buildGeneReviews.sh
     ../validateGeneReviews.sh hg38
     ../validateGeneReviews.sh hg19
     ../validateGeneReviews.sh hg18
     # now install
     installGeneReviewTables "hg38"  
     installGeneReviewTables "hg19"    
     installGeneReviewTables "hg18"
+    # now archive
+    for db in "hg18" "hg19" "hg38"
+    do
+        if [ ! -d ${WORKDIR}/archive/${db} ]; then
+            mkdir -p ${WORKDIR}/archive/${db}
+        fi
+        cd ${WORKDIR}/archive/${db}
+        mkdir ${today}
+        cd ${today}
+        printf "This directory contains a backup of the geneReviews track built on %s" "${today}" > README 
+        for i in `cat ${WORKDIR}/geneReviews.tables`
+        do
+            hgsql -Ne "show create table ${i}" ${db} > ${i}.sql
+            hgsql -Ne "select * from ${i}" ${db} | gzip >  ${i}.txt.gz
+        done
+    done
+    cd ${WORKDIR}/${today}
 
     rm -f ../lastUpdate
     cp -p NBKid_shortname_genesymbol.txt ../lastUpdate
 
 fi
 
 exit 0