Making the pg_replication check executable + minor touchups

such that `$PGUSER` is used instead of `PGUSER` and presence of `psql` in `$PATH` is enforced.