Raul Kaubi schrieb am 20.11.2020 um 09:53:
> CentOS 7
> Postgres 9 to 12
>
> For monitoring purpose, I would like that certain scripts are only run in primary server.
> So I am looking ways to universally discover if postgresql cluster that is running is primary or not.
As the standby will be in constant recovery, you can use
select pg_is_in_recovery();