From f5eeda4e5546eb23694fd2da18957928e54144df Mon Sep 17 00:00:00 2001 From: mueller Date: Thu, 5 Jan 2012 18:16:20 -0500 Subject: [PATCH] adding the db regereration script to start again with the practice to build a spare db... --- test-load-cxgn.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 test-load-cxgn.sh diff --git a/test-load-cxgn.sh b/test-load-cxgn.sh new file mode 100755 index 0000000..d27226c --- /dev/null +++ b/test-load-cxgn.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# test if database exists +sudo -u postgres psql -l | grep -q cxgn_tmp && sudo -u postgres dropdb cxgn_tmp + +### deanx - Oct 02 2007 - originally the createdb statement was part of the DB load +# below. But I found that caused login/sudo confusion and failed. now +# the createdb is simply a seperate step +sudo -u postgres createdb cxgn_tmp +### + +# reload the database from file given as parameter +{ zcat -f "$1" ; echo COMMIT ; } | + sudo -u postgres psql --echo-all --variable AUTOCOMMIT=off --variable ON_ERROR_STOP=t \ + --dbname cxgn_tmp > ${2:-/tmp/cxgn_tmp_creation_log} 2>&1 || \ + { dropdb cxgn_tmp; echo Database load failed! > /dev/stderr ; exit 1; } -- 2.11.4.GIT