Files
aliasvault/dockerfiles/all-in-one/s6-scripts/postgres/run
2025-08-11 13:18:45 +02:00

20 lines
672 B
Bash

#!/bin/sh
# Set PostgreSQL paths
export PATH="/usr/lib/postgresql/16/bin:$PATH"
export PGDATA="/database/postgres"
# Get verbosity level (0=minimal, 1=normal, 2=verbose)
VERBOSITY="${ALIASVAULT_VERBOSITY:-0}"
# Only show startup message at verbosity level 1+
echo "Starting PostgreSQL server..."
# Run PostgreSQL as postgres user with appropriate logging
if [ "$VERBOSITY" -ge 2 ]; then
# Verbose: Show all PostgreSQL logs
exec s6-setuidgid postgres /usr/lib/postgresql/16/bin/postgres -D "$PGDATA"
else
# Minimal/Normal: Redirect logs to file
exec s6-setuidgid postgres /usr/lib/postgresql/16/bin/postgres -D "$PGDATA" 2>/logs/postgres/postgres.log
fi