File tree Expand file tree Collapse file tree 18 files changed +246
-215
lines changed Expand file tree Collapse file tree 18 files changed +246
-215
lines changed Original file line number Diff line number Diff line change 17
17
set -e
18
18
19
19
echo " Running as Primary"
20
-
20
+ BOOTSTRAP= " false "
21
21
# set password ENV
22
22
export PGPASSWORD=${POSTGRES_PASSWORD:- postgres}
23
23
@@ -29,7 +29,8 @@ if [ ! -e "$PGDATA/PG_VERSION" ]; then
29
29
rm -rf " $PGDATA " /*
30
30
chmod 0700 " $PGDATA "
31
31
/scripts/initdb.sh
32
+ BOOTSTRAP=" true"
32
33
33
34
fi
34
- /run_scripts/role/start.sh
35
+ /run_scripts/role/start.sh $BOOTSTRAP
35
36
exec postgres
Original file line number Diff line number Diff line change 13
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
-
16
+ BOOTSTRAP= ${1}
17
17
# setup postgresql.conf
18
18
touch /tmp/postgresql.conf
19
19
echo " wal_level = replica" >> /tmp/postgresql.conf
83
83
psql+=(--username " $POSTGRES_USER " --dbname " $POSTGRES_DB " )
84
84
echo
85
85
86
- # initialize database
87
- for f in " $INITDB " /* ; do
88
- case " $f " in
89
- * .sh)
90
- echo " $0 : running $f "
91
- . " $f "
92
- ;;
93
- * .sql)
94
- echo " $0 : running $f "
95
- " ${psql[@]} " -f " $f "
96
- echo
97
- ;;
98
- * .sql.gz)
99
- echo " $0 : running $f "
100
- gunzip -c " $f " | " ${psql[@]} "
101
- echo
102
- ;;
103
- * ) echo " $0 : ignoring $f " ;;
104
- esac
105
- echo
106
- done
86
+ if [[ " $BOOTSTRAP " == " true" ]]; then
87
+ # initialize database
88
+ for f in " $INITDB " /* ; do
89
+ case " $f " in
90
+ * .sh)
91
+ echo " $0 : running $f "
92
+ . " $f "
93
+ ;;
94
+ * .sql)
95
+ echo " $0 : running $f "
96
+ " ${psql[@]} " -f " $f "
97
+ echo
98
+ ;;
99
+ * .sql.gz)
100
+ echo " $0 : running $f "
101
+ gunzip -c " $f " | " ${psql[@]} "
102
+ echo
103
+ ;;
104
+ * ) echo " $0 : ignoring $f " ;;
105
+ esac
106
+ echo
107
+ done
108
+ fi
107
109
108
110
# stop server
109
111
pg_ctl -D " $PGDATA " -m fast -w stop
Original file line number Diff line number Diff line change 17
17
set -e
18
18
19
19
echo " Running as Primary"
20
-
20
+ BOOTSTRAP= " false "
21
21
# set password ENV
22
22
export PGPASSWORD=${POSTGRES_PASSWORD:- postgres}
23
23
@@ -29,7 +29,8 @@ if [ ! -e "$PGDATA/PG_VERSION" ]; then
29
29
rm -rf " $PGDATA " /*
30
30
chmod 0700 " $PGDATA "
31
31
/scripts/initdb.sh
32
+ BOOTSTRAP=" true"
32
33
33
34
fi
34
- /run_scripts/role/start.sh
35
+ /run_scripts/role/start.sh $BOOTSTRAP
35
36
exec postgres
Original file line number Diff line number Diff line change 13
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
-
16
+ BOOTSTRAP= ${1}
17
17
# setup postgresql.conf
18
18
touch /tmp/postgresql.conf
19
19
echo " wal_level = replica" >> /tmp/postgresql.conf
92
92
psql+=(--username " $POSTGRES_USER " --dbname " $POSTGRES_DB " )
93
93
echo
94
94
95
- # initialize database
96
- for f in " $INITDB " /* ; do
97
- case " $f " in
98
- * .sh)
99
- echo " $0 : running $f "
100
- . " $f "
101
- ;;
102
- * .sql)
103
- echo " $0 : running $f "
104
- " ${psql[@]} " -f " $f "
105
- echo
106
- ;;
107
- * .sql.gz)
108
- echo " $0 : running $f "
109
- gunzip -c " $f " | " ${psql[@]} "
110
- echo
111
- ;;
112
- * ) echo " $0 : ignoring $f " ;;
113
- esac
114
- echo
115
- done
95
+ if [[ " $BOOTSTRAP " == " true" ]]; then
96
+ # initialize database
97
+ for f in " $INITDB " /* ; do
98
+ case " $f " in
99
+ * .sh)
100
+ echo " $0 : running $f "
101
+ . " $f "
102
+ ;;
103
+ * .sql)
104
+ echo " $0 : running $f "
105
+ " ${psql[@]} " -f " $f "
106
+ echo
107
+ ;;
108
+ * .sql.gz)
109
+ echo " $0 : running $f "
110
+ gunzip -c " $f " | " ${psql[@]} "
111
+ echo
112
+ ;;
113
+ * ) echo " $0 : ignoring $f " ;;
114
+ esac
115
+ echo
116
+ done
117
+ fi
116
118
117
119
# stop server
118
120
pg_ctl -D " $PGDATA " -m fast -w stop
Original file line number Diff line number Diff line change 17
17
set -e
18
18
19
19
echo " Running as Primary"
20
-
20
+ BOOTSTRAP= " false "
21
21
# set password ENV
22
22
export PGPASSWORD=${POSTGRES_PASSWORD:- postgres}
23
23
@@ -29,7 +29,8 @@ if [ ! -e "$PGDATA/PG_VERSION" ]; then
29
29
rm -rf " $PGDATA " /*
30
30
chmod 0700 " $PGDATA "
31
31
/scripts/initdb.sh
32
+ BOOTSTRAP=" true"
32
33
33
34
fi
34
- /run_scripts/role/start.sh
35
+ /run_scripts/role/start.sh $BOOTSTRAP
35
36
exec postgres
Original file line number Diff line number Diff line change 13
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
-
16
+ BOOTSTRAP= ${1}
17
17
# setup postgresql.conf
18
18
touch /tmp/postgresql.conf
19
19
echo " wal_level = replica" >> /tmp/postgresql.conf
@@ -108,27 +108,29 @@ echo
108
108
psql+=(--username " $POSTGRES_USER " --dbname " $POSTGRES_DB " )
109
109
echo
110
110
111
- # initialize database
112
- for f in " $INITDB " /* ; do
113
- case " $f " in
114
- * .sh)
115
- echo " $0 : running $f "
116
- . " $f "
117
- ;;
118
- * .sql)
119
- echo " $0 : running $f "
120
- " ${psql[@]} " -f " $f "
121
- echo
122
- ;;
123
- * .sql.gz)
124
- echo " $0 : running $f "
125
- gunzip -c " $f " | " ${psql[@]} "
126
- echo
127
- ;;
128
- * ) echo " $0 : ignoring $f " ;;
129
- esac
130
- echo
131
- done
111
+ if [[ " $BOOTSTRAP " == " true" ]]; then
112
+ # initialize database
113
+ for f in " $INITDB " /* ; do
114
+ case " $f " in
115
+ * .sh)
116
+ echo " $0 : running $f "
117
+ . " $f "
118
+ ;;
119
+ * .sql)
120
+ echo " $0 : running $f "
121
+ " ${psql[@]} " -f " $f "
122
+ echo
123
+ ;;
124
+ * .sql.gz)
125
+ echo " $0 : running $f "
126
+ gunzip -c " $f " | " ${psql[@]} "
127
+ echo
128
+ ;;
129
+ * ) echo " $0 : ignoring $f " ;;
130
+ esac
131
+ echo
132
+ done
133
+ fi
132
134
133
135
# stop server
134
136
pg_ctl -D " $PGDATA " -m fast -w stop
Original file line number Diff line number Diff line change 17
17
set -e
18
18
19
19
echo " Running as Primary"
20
-
20
+ BOOTSTRAP= " false "
21
21
# set password ENV
22
22
export PGPASSWORD=${POSTGRES_PASSWORD:- postgres}
23
23
@@ -29,7 +29,8 @@ if [ ! -e "$PGDATA/PG_VERSION" ]; then
29
29
rm -rf " $PGDATA " /*
30
30
chmod 0700 " $PGDATA "
31
31
/scripts/initdb.sh
32
+ BOOTSTRAP=" true"
32
33
33
34
fi
34
- /run_scripts/role/start.sh
35
+ /run_scripts/role/start.sh $BOOTSTRAP
35
36
exec postgres
Original file line number Diff line number Diff line change 13
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
-
16
+ BOOTSTRAP= ${1}
17
17
# setup postgresql.conf
18
18
touch /tmp/postgresql.conf
19
19
echo " wal_level = replica" >> /tmp/postgresql.conf
@@ -109,27 +109,29 @@ echo
109
109
psql+=(--username " $POSTGRES_USER " --dbname " $POSTGRES_DB " )
110
110
echo
111
111
112
- # initialize database
113
- for f in " $INITDB " /* ; do
114
- case " $f " in
115
- * .sh)
116
- echo " $0 : running $f "
117
- . " $f "
118
- ;;
119
- * .sql)
120
- echo " $0 : running $f "
121
- " ${psql[@]} " -f " $f "
122
- echo
123
- ;;
124
- * .sql.gz)
125
- echo " $0 : running $f "
126
- gunzip -c " $f " | " ${psql[@]} "
127
- echo
128
- ;;
129
- * ) echo " $0 : ignoring $f " ;;
130
- esac
131
- echo
132
- done
112
+ if [[ " $BOOTSTRAP " == " true" ]]; then
113
+ # initialize database
114
+ for f in " $INITDB " /* ; do
115
+ case " $f " in
116
+ * .sh)
117
+ echo " $0 : running $f "
118
+ . " $f "
119
+ ;;
120
+ * .sql)
121
+ echo " $0 : running $f "
122
+ " ${psql[@]} " -f " $f "
123
+ echo
124
+ ;;
125
+ * .sql.gz)
126
+ echo " $0 : running $f "
127
+ gunzip -c " $f " | " ${psql[@]} "
128
+ echo
129
+ ;;
130
+ * ) echo " $0 : ignoring $f " ;;
131
+ esac
132
+ echo
133
+ done
134
+ fi
133
135
134
136
# stop server
135
137
pg_ctl -D " $PGDATA " -m fast -w stop
Original file line number Diff line number Diff line change 17
17
set -e
18
18
19
19
echo " Running as Primary"
20
-
20
+ BOOTSTRAP= " false "
21
21
# set password ENV
22
22
export PGPASSWORD=${POSTGRES_PASSWORD:- postgres}
23
23
@@ -29,7 +29,8 @@ if [ ! -e "$PGDATA/PG_VERSION" ]; then
29
29
rm -rf " $PGDATA " /*
30
30
chmod 0700 " $PGDATA "
31
31
/scripts/initdb.sh
32
+ BOOTSTRAP=" true"
32
33
33
34
fi
34
- /run_scripts/role/start.sh
35
+ /run_scripts/role/start.sh $BOOTSTRAP
35
36
exec postgres
Original file line number Diff line number Diff line change 13
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
14
# See the License for the specific language governing permissions and
15
15
# limitations under the License.
16
-
16
+ BOOTSTRAP= ${1}
17
17
# setup postgresql.conf
18
18
touch /tmp/postgresql.conf
19
19
echo " wal_level = replica" >> /tmp/postgresql.conf
@@ -115,27 +115,29 @@ echo
115
115
psql+=(--username " $POSTGRES_USER " --dbname " $POSTGRES_DB " )
116
116
echo
117
117
118
- # initialize database
119
- for f in " $INITDB " /* ; do
120
- case " $f " in
121
- * .sh)
122
- echo " $0 : running $f "
123
- . " $f "
124
- ;;
125
- * .sql)
126
- echo " $0 : running $f "
127
- " ${psql[@]} " -f " $f "
128
- echo
129
- ;;
130
- * .sql.gz)
131
- echo " $0 : running $f "
132
- gunzip -c " $f " | " ${psql[@]} "
133
- echo
134
- ;;
135
- * ) echo " $0 : ignoring $f " ;;
136
- esac
137
- echo
138
- done
118
+ if [[ " $BOOTSTRAP " == " true" ]]; then
119
+ # initialize database
120
+ for f in " $INITDB " /* ; do
121
+ case " $f " in
122
+ * .sh)
123
+ echo " $0 : running $f "
124
+ . " $f "
125
+ ;;
126
+ * .sql)
127
+ echo " $0 : running $f "
128
+ " ${psql[@]} " -f " $f "
129
+ echo
130
+ ;;
131
+ * .sql.gz)
132
+ echo " $0 : running $f "
133
+ gunzip -c " $f " | " ${psql[@]} "
134
+ echo
135
+ ;;
136
+ * ) echo " $0 : ignoring $f " ;;
137
+ esac
138
+ echo
139
+ done
140
+ fi
139
141
140
142
# stop server
141
143
pg_ctl -D " $PGDATA " -m fast -w stop
You can’t perform that action at this time.
0 commit comments