diff --git a/bitnami/postgresql/14/debian-10/rootfs/opt/bitnami/scripts/libpostgresql.sh b/bitnami/postgresql/14/debian-10/rootfs/opt/bitnami/scripts/libpostgresql.sh index 9fea03c2f007..37216cf67c66 100644 --- a/bitnami/postgresql/14/debian-10/rootfs/opt/bitnami/scripts/libpostgresql.sh +++ b/bitnami/postgresql/14/debian-10/rootfs/opt/bitnami/scripts/libpostgresql.sh @@ -567,8 +567,6 @@ postgresql_clean_from_restart() { ######################### postgresql_initialize() { info "Initializing PostgreSQL database..." - postgresql_clean_from_restart - # This fixes an issue where the trap would kill the entrypoint.sh, if a PID was left over from a previous run # Exec replaces the process without creating a new one, and when the container is restarted it may have the same PID rm -f "$POSTGRESQL_PID_FILE" diff --git a/bitnami/postgresql/14/debian-10/rootfs/opt/bitnami/scripts/postgresql/setup.sh b/bitnami/postgresql/14/debian-10/rootfs/opt/bitnami/scripts/postgresql/setup.sh index d1d6702e020a..c88cb0dc6b18 100755 --- a/bitnami/postgresql/14/debian-10/rootfs/opt/bitnami/scripts/postgresql/setup.sh +++ b/bitnami/postgresql/14/debian-10/rootfs/opt/bitnami/scripts/postgresql/setup.sh @@ -25,6 +25,8 @@ trap "postgresql_stop" EXIT am_i_root && ensure_user_exists "$POSTGRESQL_DAEMON_USER" --group "$POSTGRESQL_DAEMON_GROUP" # Fix logging issue when running as root am_i_root && chmod o+w "$(readlink /dev/stdout)" +# Remove flags and postmaster files from a previous run +postgresql_clean_from_restart # Allow running custom pre-initialization scripts postgresql_custom_pre_init_scripts # Ensure PostgreSQL is initialized