Files
2026-01-03 21:55:47 +00:00

17 lines
416 B
Bash
Executable File

#!/bin/bash
set -eo pipefail
if [ "$1" != "foreground" ]; then
exec ~/.local/bin/screen/detach.sh postgres "$0" foreground
fi
version="$(pg_config --version | sed -n 's/^PostgreSQL \([0-9]*\).*/\1/p')"
export PGDATA=~/know/db/"$version"
mkdir -p "$PGDATA"
if [ ! -f "$PGDATA/postgresql.conf" ]; then
initdb
fi
postgres -c "unix_socket_directories=/run/user/$(id -u)" -c "listen_addresses=" -c "io_method=sync"