Skip to content

Commit de313db

Browse files
committed
Change log configuration
1 parent e430162 commit de313db

File tree

12 files changed

+337
-11
lines changed

12 files changed

+337
-11
lines changed

9.2/alpine/docker-entrypoint.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
#!/bin/bash
22
set -e
33

4+
##
5+
# Cliix specific functions
6+
##
7+
configure_log() {
8+
CONF_FILE="${PGDATA}/postgresql.conf"
9+
if [ -f ${CONF_FILE} ]; then
10+
cp ${CONF_FILE} /tmp/postgresql.conf
11+
sed -i 's/#log_min_duration_statement = -1/log_min_duration_statement = 150/g;
12+
s/#log_connections = off/log_connections = on/g;
13+
s/#log_disconnections = off/log_disconnections = on/g;
14+
s/#log_lock_waits = off/log_lock_waits = on/g' /tmp/postgresql.conf
15+
if [ $(cmp -s /tmp/postgresql.conf ${CONF_FILE} && echo 0 || echo 1) -eq 1 ]; then
16+
echo "Configuration file changed."
17+
cp ${CONF_FILE} ${CONF_FILE}.ori
18+
mv /tmp/postgresql.conf ${CONF_FILE}
19+
else
20+
echo "No configuration changed this time."
21+
fi
22+
else
23+
echo "Oops! Config file not available."
24+
fi
25+
}
26+
27+
28+
###
29+
# Original
30+
###
431
# usage: file_env VAR [DEFAULT]
532
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
633
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
@@ -78,7 +105,7 @@ if [ "$1" = 'postgres' ]; then
78105

79106
{ echo; echo "host all all all $authMethod"; } | tee -a "$PGDATA/pg_hba.conf" > /dev/null
80107

81-
# internal start of server in order to allow set-up using psql-client
108+
# internal start of server in order to allow set-up using psql-client
82109
# does not listen on external TCP/IP and waits until start finishes
83110
PGUSER="${PGUSER:-postgres}" \
84111
pg_ctl -D "$PGDATA" \
@@ -129,4 +156,6 @@ if [ "$1" = 'postgres' ]; then
129156
fi
130157
fi
131158

159+
configure_log
160+
132161
exec "$@"

9.2/docker-entrypoint.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
#!/bin/bash
22
set -e
33

4+
##
5+
# Cliix specific functions
6+
##
7+
configure_log() {
8+
CONF_FILE="${PGDATA}/postgresql.conf"
9+
if [ -f ${CONF_FILE} ]; then
10+
cp ${CONF_FILE} /tmp/postgresql.conf
11+
sed -i 's/#log_min_duration_statement = -1/log_min_duration_statement = 150/g;
12+
s/#log_connections = off/log_connections = on/g;
13+
s/#log_disconnections = off/log_disconnections = on/g;
14+
s/#log_lock_waits = off/log_lock_waits = on/g' /tmp/postgresql.conf
15+
if [ $(cmp -s /tmp/postgresql.conf ${CONF_FILE} && echo 0 || echo 1) -eq 1 ]; then
16+
echo "Configuration file changed."
17+
cp ${CONF_FILE} ${CONF_FILE}.ori
18+
mv /tmp/postgresql.conf ${CONF_FILE}
19+
else
20+
echo "No configuration changed this time."
21+
fi
22+
else
23+
echo "Oops! Config file not available."
24+
fi
25+
}
26+
27+
28+
###
29+
# Original
30+
###
431
# usage: file_env VAR [DEFAULT]
532
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
633
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
@@ -78,7 +105,7 @@ if [ "$1" = 'postgres' ]; then
78105

79106
{ echo; echo "host all all all $authMethod"; } | tee -a "$PGDATA/pg_hba.conf" > /dev/null
80107

81-
# internal start of server in order to allow set-up using psql-client
108+
# internal start of server in order to allow set-up using psql-client
82109
# does not listen on external TCP/IP and waits until start finishes
83110
PGUSER="${PGUSER:-postgres}" \
84111
pg_ctl -D "$PGDATA" \
@@ -129,4 +156,6 @@ if [ "$1" = 'postgres' ]; then
129156
fi
130157
fi
131158

159+
configure_log
160+
132161
exec "$@"

9.3/alpine/docker-entrypoint.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
#!/bin/bash
22
set -e
33

4+
##
5+
# Cliix specific functions
6+
##
7+
configure_log() {
8+
CONF_FILE="${PGDATA}/postgresql.conf"
9+
if [ -f ${CONF_FILE} ]; then
10+
cp ${CONF_FILE} /tmp/postgresql.conf
11+
sed -i 's/#log_min_duration_statement = -1/log_min_duration_statement = 150/g;
12+
s/#log_connections = off/log_connections = on/g;
13+
s/#log_disconnections = off/log_disconnections = on/g;
14+
s/#log_lock_waits = off/log_lock_waits = on/g' /tmp/postgresql.conf
15+
if [ $(cmp -s /tmp/postgresql.conf ${CONF_FILE} && echo 0 || echo 1) -eq 1 ]; then
16+
echo "Configuration file changed."
17+
cp ${CONF_FILE} ${CONF_FILE}.ori
18+
mv /tmp/postgresql.conf ${CONF_FILE}
19+
else
20+
echo "No configuration changed this time."
21+
fi
22+
else
23+
echo "Oops! Config file not available."
24+
fi
25+
}
26+
27+
28+
###
29+
# Original
30+
###
431
# usage: file_env VAR [DEFAULT]
532
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
633
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
@@ -78,7 +105,7 @@ if [ "$1" = 'postgres' ]; then
78105

79106
{ echo; echo "host all all all $authMethod"; } | tee -a "$PGDATA/pg_hba.conf" > /dev/null
80107

81-
# internal start of server in order to allow set-up using psql-client
108+
# internal start of server in order to allow set-up using psql-client
82109
# does not listen on external TCP/IP and waits until start finishes
83110
PGUSER="${PGUSER:-postgres}" \
84111
pg_ctl -D "$PGDATA" \
@@ -129,4 +156,6 @@ if [ "$1" = 'postgres' ]; then
129156
fi
130157
fi
131158

159+
configure_log
160+
132161
exec "$@"

9.3/docker-entrypoint.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
#!/bin/bash
22
set -e
33

4+
##
5+
# Cliix specific functions
6+
##
7+
configure_log() {
8+
CONF_FILE="${PGDATA}/postgresql.conf"
9+
if [ -f ${CONF_FILE} ]; then
10+
cp ${CONF_FILE} /tmp/postgresql.conf
11+
sed -i 's/#log_min_duration_statement = -1/log_min_duration_statement = 150/g;
12+
s/#log_connections = off/log_connections = on/g;
13+
s/#log_disconnections = off/log_disconnections = on/g;
14+
s/#log_lock_waits = off/log_lock_waits = on/g' /tmp/postgresql.conf
15+
if [ $(cmp -s /tmp/postgresql.conf ${CONF_FILE} && echo 0 || echo 1) -eq 1 ]; then
16+
echo "Configuration file changed."
17+
cp ${CONF_FILE} ${CONF_FILE}.ori
18+
mv /tmp/postgresql.conf ${CONF_FILE}
19+
else
20+
echo "No configuration changed this time."
21+
fi
22+
else
23+
echo "Oops! Config file not available."
24+
fi
25+
}
26+
27+
28+
###
29+
# Original
30+
###
431
# usage: file_env VAR [DEFAULT]
532
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
633
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
@@ -78,7 +105,7 @@ if [ "$1" = 'postgres' ]; then
78105

79106
{ echo; echo "host all all all $authMethod"; } | tee -a "$PGDATA/pg_hba.conf" > /dev/null
80107

81-
# internal start of server in order to allow set-up using psql-client
108+
# internal start of server in order to allow set-up using psql-client
82109
# does not listen on external TCP/IP and waits until start finishes
83110
PGUSER="${PGUSER:-postgres}" \
84111
pg_ctl -D "$PGDATA" \
@@ -129,4 +156,6 @@ if [ "$1" = 'postgres' ]; then
129156
fi
130157
fi
131158

159+
configure_log
160+
132161
exec "$@"

9.4/alpine/docker-entrypoint.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
#!/bin/bash
22
set -e
33

4+
##
5+
# Cliix specific functions
6+
##
7+
configure_log() {
8+
CONF_FILE="${PGDATA}/postgresql.conf"
9+
if [ -f ${CONF_FILE} ]; then
10+
cp ${CONF_FILE} /tmp/postgresql.conf
11+
sed -i 's/#log_min_duration_statement = -1/log_min_duration_statement = 150/g;
12+
s/#log_connections = off/log_connections = on/g;
13+
s/#log_disconnections = off/log_disconnections = on/g;
14+
s/#log_lock_waits = off/log_lock_waits = on/g' /tmp/postgresql.conf
15+
if [ $(cmp -s /tmp/postgresql.conf ${CONF_FILE} && echo 0 || echo 1) -eq 1 ]; then
16+
echo "Configuration file changed."
17+
cp ${CONF_FILE} ${CONF_FILE}.ori
18+
mv /tmp/postgresql.conf ${CONF_FILE}
19+
else
20+
echo "No configuration changed this time."
21+
fi
22+
else
23+
echo "Oops! Config file not available."
24+
fi
25+
}
26+
27+
28+
###
29+
# Original
30+
###
431
# usage: file_env VAR [DEFAULT]
532
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
633
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
@@ -78,7 +105,7 @@ if [ "$1" = 'postgres' ]; then
78105

79106
{ echo; echo "host all all all $authMethod"; } | tee -a "$PGDATA/pg_hba.conf" > /dev/null
80107

81-
# internal start of server in order to allow set-up using psql-client
108+
# internal start of server in order to allow set-up using psql-client
82109
# does not listen on external TCP/IP and waits until start finishes
83110
PGUSER="${PGUSER:-postgres}" \
84111
pg_ctl -D "$PGDATA" \
@@ -129,4 +156,6 @@ if [ "$1" = 'postgres' ]; then
129156
fi
130157
fi
131158

159+
configure_log
160+
132161
exec "$@"

9.4/docker-entrypoint.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
#!/bin/bash
22
set -e
33

4+
##
5+
# Cliix specific functions
6+
##
7+
configure_log() {
8+
CONF_FILE="${PGDATA}/postgresql.conf"
9+
if [ -f ${CONF_FILE} ]; then
10+
cp ${CONF_FILE} /tmp/postgresql.conf
11+
sed -i 's/#log_min_duration_statement = -1/log_min_duration_statement = 150/g;
12+
s/#log_connections = off/log_connections = on/g;
13+
s/#log_disconnections = off/log_disconnections = on/g;
14+
s/#log_lock_waits = off/log_lock_waits = on/g' /tmp/postgresql.conf
15+
if [ $(cmp -s /tmp/postgresql.conf ${CONF_FILE} && echo 0 || echo 1) -eq 1 ]; then
16+
echo "Configuration file changed."
17+
cp ${CONF_FILE} ${CONF_FILE}.ori
18+
mv /tmp/postgresql.conf ${CONF_FILE}
19+
else
20+
echo "No configuration changed this time."
21+
fi
22+
else
23+
echo "Oops! Config file not available."
24+
fi
25+
}
26+
27+
28+
###
29+
# Original
30+
###
431
# usage: file_env VAR [DEFAULT]
532
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
633
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
@@ -78,7 +105,7 @@ if [ "$1" = 'postgres' ]; then
78105

79106
{ echo; echo "host all all all $authMethod"; } | tee -a "$PGDATA/pg_hba.conf" > /dev/null
80107

81-
# internal start of server in order to allow set-up using psql-client
108+
# internal start of server in order to allow set-up using psql-client
82109
# does not listen on external TCP/IP and waits until start finishes
83110
PGUSER="${PGUSER:-postgres}" \
84111
pg_ctl -D "$PGDATA" \
@@ -129,4 +156,6 @@ if [ "$1" = 'postgres' ]; then
129156
fi
130157
fi
131158

159+
configure_log
160+
132161
exec "$@"

9.5/alpine/docker-entrypoint.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
#!/bin/bash
22
set -e
33

4+
##
5+
# Cliix specific functions
6+
##
7+
configure_log() {
8+
CONF_FILE="${PGDATA}/postgresql.conf"
9+
if [ -f ${CONF_FILE} ]; then
10+
cp ${CONF_FILE} /tmp/postgresql.conf
11+
sed -i 's/#log_min_duration_statement = -1/log_min_duration_statement = 150/g;
12+
s/#log_connections = off/log_connections = on/g;
13+
s/#log_disconnections = off/log_disconnections = on/g;
14+
s/#log_lock_waits = off/log_lock_waits = on/g' /tmp/postgresql.conf
15+
if [ $(cmp -s /tmp/postgresql.conf ${CONF_FILE} && echo 0 || echo 1) -eq 1 ]; then
16+
echo "Configuration file changed."
17+
cp ${CONF_FILE} ${CONF_FILE}.ori
18+
mv /tmp/postgresql.conf ${CONF_FILE}
19+
else
20+
echo "No configuration changed this time."
21+
fi
22+
else
23+
echo "Oops! Config file not available."
24+
fi
25+
}
26+
27+
28+
###
29+
# Original
30+
###
431
# usage: file_env VAR [DEFAULT]
532
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
633
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
@@ -78,7 +105,7 @@ if [ "$1" = 'postgres' ]; then
78105

79106
{ echo; echo "host all all all $authMethod"; } | tee -a "$PGDATA/pg_hba.conf" > /dev/null
80107

81-
# internal start of server in order to allow set-up using psql-client
108+
# internal start of server in order to allow set-up using psql-client
82109
# does not listen on external TCP/IP and waits until start finishes
83110
PGUSER="${PGUSER:-postgres}" \
84111
pg_ctl -D "$PGDATA" \
@@ -129,4 +156,6 @@ if [ "$1" = 'postgres' ]; then
129156
fi
130157
fi
131158

159+
configure_log
160+
132161
exec "$@"

9.5/docker-entrypoint.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
#!/bin/bash
22
set -e
33

4+
##
5+
# Cliix specific functions
6+
##
7+
configure_log() {
8+
CONF_FILE="${PGDATA}/postgresql.conf"
9+
if [ -f ${CONF_FILE} ]; then
10+
cp ${CONF_FILE} /tmp/postgresql.conf
11+
sed -i 's/#log_min_duration_statement = -1/log_min_duration_statement = 150/g;
12+
s/#log_connections = off/log_connections = on/g;
13+
s/#log_disconnections = off/log_disconnections = on/g;
14+
s/#log_lock_waits = off/log_lock_waits = on/g' /tmp/postgresql.conf
15+
if [ $(cmp -s /tmp/postgresql.conf ${CONF_FILE} && echo 0 || echo 1) -eq 1 ]; then
16+
echo "Configuration file changed."
17+
cp ${CONF_FILE} ${CONF_FILE}.ori
18+
mv /tmp/postgresql.conf ${CONF_FILE}
19+
else
20+
echo "No configuration changed this time."
21+
fi
22+
else
23+
echo "Oops! Config file not available."
24+
fi
25+
}
26+
27+
28+
###
29+
# Original
30+
###
431
# usage: file_env VAR [DEFAULT]
532
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
633
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
@@ -78,7 +105,7 @@ if [ "$1" = 'postgres' ]; then
78105

79106
{ echo; echo "host all all all $authMethod"; } | tee -a "$PGDATA/pg_hba.conf" > /dev/null
80107

81-
# internal start of server in order to allow set-up using psql-client
108+
# internal start of server in order to allow set-up using psql-client
82109
# does not listen on external TCP/IP and waits until start finishes
83110
PGUSER="${PGUSER:-postgres}" \
84111
pg_ctl -D "$PGDATA" \
@@ -129,4 +156,6 @@ if [ "$1" = 'postgres' ]; then
129156
fi
130157
fi
131158

159+
configure_log
160+
132161
exec "$@"

0 commit comments

Comments
 (0)