#!/bin/bash

# fail fast
set -e

# check if database is running
gosu postgres pg_ctl status -D $PGDATA

QUERY=$(gosu postgres psql -Atc 'SELECT pg_is_in_recovery()')

if [ "$QUERY" == "f" ]; then
    exit 0
fi

exit 1
