Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pre_and_post_scrs/psql_create_db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/bash
echo -e "\n ======= `date`:: CREATE DATABASE script called ...... ======== \n" > /tmp/psql_create_db.log
export pgsqlpath=$1
export ybsrv=$2
export pgpass=$3
export dbname=$4
export coloflag=$5
if [[ ${coloflag} == "true" ]]; then
echo -e "\n ==== Selected colo ==== \n"
export setcolo="colocated=true"
fi
echo -e "PGPASSWORD=${pgpass} ${pgsqlpath} -h ${ybsrv} -p 5433 -U yugabyte -c \"CREATE DATABASE ${dbname} ${setcolo};\" " >> /tmp/psql_create_db.log
PGPASSWORD=${pgpass} ${pgsqlpath} -h ${ybsrv} -p 5433 -U yugabyte -c "CREATE DATABASE ${dbname} ${setcolo};" >> /tmp/psql_create_db.log & 2>&1
sleep 5
PGPASSWORD=${pgpass} ${pgsqlpath} -h ${ybsrv} -p 5433 -U yugabyte -c "\l+" >> /tmp/psql_create_db.log & 2>&1
echo -e "\n ============== CREATE DATABASE done at: `date` =================== \n" >> /tmp/psql_create_db.log
/usr/bin/cat /tmp/psql_create_db.log