Catch and print the postgresql initdb error
The logs are stored, by default, in /var/lib/pgsql/initdb_postgresql.log. Related-Bug: #2083482 Change-Id: I2c83e896819b20cd7a1ee8d8ee33354fb047a6d9
This commit is contained in:
parent
03bc214525
commit
f49d475bf2
@ -46,6 +46,10 @@ function recreate_database_postgresql {
|
|||||||
createdb -h $DATABASE_HOST -U$DATABASE_USER -l C -T template0 -E utf8 $db
|
createdb -h $DATABASE_HOST -U$DATABASE_USER -l C -T template0 -E utf8 $db
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _exit_pg_init {
|
||||||
|
sudo cat /var/lib/pgsql/initdb_postgresql.log
|
||||||
|
}
|
||||||
|
|
||||||
function configure_database_postgresql {
|
function configure_database_postgresql {
|
||||||
local pg_conf pg_dir pg_hba check_role version
|
local pg_conf pg_dir pg_hba check_role version
|
||||||
echo_summary "Configuring and starting PostgreSQL"
|
echo_summary "Configuring and starting PostgreSQL"
|
||||||
@ -53,7 +57,9 @@ function configure_database_postgresql {
|
|||||||
pg_hba=/var/lib/pgsql/data/pg_hba.conf
|
pg_hba=/var/lib/pgsql/data/pg_hba.conf
|
||||||
pg_conf=/var/lib/pgsql/data/postgresql.conf
|
pg_conf=/var/lib/pgsql/data/postgresql.conf
|
||||||
if ! sudo [ -e $pg_hba ]; then
|
if ! sudo [ -e $pg_hba ]; then
|
||||||
|
trap _exit_pg_init EXIT
|
||||||
sudo postgresql-setup initdb
|
sudo postgresql-setup initdb
|
||||||
|
trap - EXIT
|
||||||
fi
|
fi
|
||||||
elif is_ubuntu; then
|
elif is_ubuntu; then
|
||||||
version=`psql --version | cut -d ' ' -f3 | cut -d. -f1-2`
|
version=`psql --version | cut -d ' ' -f3 | cut -d. -f1-2`
|
||||||
|
Loading…
Reference in New Issue
Block a user