Kuby/verifier_role_db.sh

4 lines
126 B
Bash
Raw Permalink Normal View History

#!/bin/bash
ROLE=$(psql -U postgres -tAc "SELECT pg_is_in_recovery();")
[ "$ROLE" = "f" ] && echo "primary" || echo "replica"