File size: 363 Bytes
36faa5c
 
3bd145b
 
 
0ba050c
3bd145b
 
 
0ba050c
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

# Check if the PostgreSQL data directory is empty
if [ -z "$(ls -A /var/lib/postgresql/data)" ]; then
    echo "Initializing PostgreSQL database..."
    su - foobar -c "/usr/lib/postgresql/*/bin/initdb -D /var/lib/postgresql/data"
fi

# Start the PostgreSQL server
exec su - foobar -c "/usr/lib/postgresql/*/bin/postgres -D /var/lib/postgresql/data"