|
1 | 1 | #!/bin/bash |
2 | 2 | set -e |
3 | 3 |
|
| 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 | +### |
4 | 31 | # usage: file_env VAR [DEFAULT] |
5 | 32 | # ie: file_env 'XYZ_DB_PASSWORD' 'example' |
6 | 33 | # (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of |
@@ -78,7 +105,7 @@ if [ "$1" = 'postgres' ]; then |
78 | 105 |
|
79 | 106 | { echo; echo "host all all all $authMethod"; } | tee -a "$PGDATA/pg_hba.conf" > /dev/null |
80 | 107 |
|
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 |
82 | 109 | # does not listen on external TCP/IP and waits until start finishes |
83 | 110 | PGUSER="${PGUSER:-postgres}" \ |
84 | 111 | pg_ctl -D "$PGDATA" \ |
@@ -129,4 +156,6 @@ if [ "$1" = 'postgres' ]; then |
129 | 156 | fi |
130 | 157 | fi |
131 | 158 |
|
| 159 | +configure_log |
| 160 | + |
132 | 161 | exec "$@" |
0 commit comments