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/gwas/checkGwas.sh src/hg/utils/otto/gwas/checkGwas.sh
index 7dbc378..0edfea5 100755
--- src/hg/utils/otto/gwas/checkGwas.sh
+++ src/hg/utils/otto/gwas/checkGwas.sh
@@ -68,18 +68,35 @@
 
 ../validateGwas.sh hg18
 ../validateGwas.sh hg19
 ../validateGwas.sh hg38
 
 # now install for hg18 and hg19 and hg38
 for i in gwasCatalog
 do 
     n=$i"New"
     o=$i"Old"
     hgsqlSwapTables hg18 $n $i $o -dropTable3
     hgsqlSwapTables hg19 $n $i $o -dropTable3
     hgsqlSwapTables hg38 $n $i $o -dropTable3
 done
 
+# now archive
+# match other archive date formats
+dateDir=`date +%F`
+if [ ! -d ${WORKDIR}/archive ]; then
+    mkdir -p ${WORKDIR}/archive
+fi
+cd ${WORKDIR}/archive
+for db in "hg18" "hg19" "hg38"
+do
+    mkdir -p ${db}/${dateDir}
+    cd ${db}/${dateDir}
+    printf "This directory contains a backup of the GWAS Catalog track data tables built on %s\n" "${dateDir}" > README 
+    hgsql --raw -Ne "show create table gwasCatalog" ${db} > gwasCatalog.sql
+    hgsql -Ne "select * from gwasCatalog" ${db} | gzip >  gwasCatalog.txt.gz
+done
+
+
 echo "Gwas Installed `date`"