don't background the editor if we are not under X
[sgn-devtools.git] / test-load-cxgn.sh
blobd27226c5271f26904d54cfa2cb17ade83f21d795
1 #!/bin/sh
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
10 ###
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; }