3 # test if database exists
4 sudo
-u postgres psql
-l |
grep -q cxgn_tmp
&& sudo
-u postgres dropdb cxgn_tmp
6 ### deanx - Oct 02 2007 - originally the createdb statement was part of the DB load
7 # below. But I found that caused login/sudo confusion and failed. now
8 # the createdb is simply a seperate step
9 sudo
-u postgres createdb cxgn_tmp
12 # reload the database from file given as parameter
13 { zcat
-f "$1" ; echo COMMIT
; } |
14 sudo
-u postgres psql
--echo-all --variable AUTOCOMMIT
=off
--variable ON_ERROR_STOP
=t \
15 --dbname cxgn_tmp
> ${2:-/tmp/cxgn_tmp_creation_log} 2>&1 || \
16 { dropdb cxgn_tmp
; echo Database load failed
! > /dev
/stderr
; exit 1; }