lmnr-test-1 / init-postgres.sh
Din
try naming the default user postgres
5f9a9a8
Raw
History Blame Contribute Delete
546 Bytes
#! /bin/bash
pg_ctlcluster 15 main start
# Wait for PostgreSQL to be ready
echo "Waiting for PostgreSQL to be ready..."
attempts=0
max_attempts=30
until pg_isready -h localhost || [ $attempts -ge $max_attempts ]; do
echo "Waiting for PostgreSQL to be ready... (attempt $((attempts + 1))/$max_attempts)"
attempts=$((attempts + 1))
sleep 1
done
if [ $attempts -ge $max_attempts ]; then
echo "Error: PostgreSQL failed to start after $max_attempts attempts"
exit 1
fi
psql -c "ALTER USER postgres WITH PASSWORD 'postgres_passwordabc';"