Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5b11229

Browse files
committed
Update start_pgsql.sh
1 parent be3af08 commit 5b11229

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

start_pgsql.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/bash
22

3-
if [[ ! -z "$1" ]]; then
3+
if [[ ! -f /opt/postgresql/initialized ]]; then
44
mkdir -p /opt/postgresql
55
cp -a /var/lib/postgresql/* /opt/postgresql/
66
chown -R postgres:postgres /opt/postgresql
77
su postgres sh -c "/usr/lib/postgresql/9.1/bin/postgres --single -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" <<< "CREATE USER root WITH SUPERUSER PASSWORD '$1';"
88
su postgres sh -c "/usr/lib/postgresql/9.1/bin/postgres --single -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf" <<< "CREATE DATABASE db;"
9+
touch /opt/postgresql/initialized
910
fi
1011
su postgres sh -c "/usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf -c listen_addresses=*"

0 commit comments

Comments
 (0)