util.sh (919B)
1 export PATH=$HOME/.npm-global/bin:$PATH 2 export PATH=$HOME/local/bin:$PATH 3 export PATH=/lib/postgresql/15/bin/:$PATH 4 5 export DBDIR=$HOME/talerdb 6 export LOGDIR=$HOME/logs 7 export TMPDIR=$HOME/tmp 8 export SOCKDIR=$HOME/sockets 9 export PGHOST=$SOCKDIR 10 11 function db_start() { 12 mkdir -p $SOCKDIR 13 mkdir -p $LOGDIR 14 mkdir -p $TMPDIR 15 initdb --no-sync --auth=trust -D $DBDIR # > /logs/postgres-dbinit.log 2> /logs/postgres-dbinit.er 16 echo "Launching Postgres" 17 cat - > $DBDIR/postgresql.conf <<EOF 18 unix_socket_directories='$SOCKDIR' 19 fsync=off 20 max_wal_senders=0 21 synchronous_commit=off 22 wal_level=minimal 23 listen_addresses='' 24 EOF 25 cat $DBDIR/pg_hba.conf | grep -v host > $DBDIR/pg_hba.conf.new 26 mv $DBDIR/pg_hba.conf.new $DBDIR/pg_hba.conf 27 pg_ctl -D $DBDIR -l /dev/null start > $LOGDIR/postgres-start.log 2> $LOGDIR/postgres-start.err 28 echo " DONE" 29 } 30 31 db_destroy() { 32 pg_ctl -D $DBDIR -l /dev/null stop 33 rm -rf $DBDIR 34 }