You can check the status of PostgreSQL using the pg_isready command. This command checks the connection status of the PostgreSQL server. Here’s how to use it:
pg_isready
If PostgreSQL is running and accepting connections, you will see output similar to:
/var/run/postgresql:5432 - accepting connections
Alternatively, you can also check the status using the systemctl command if you are on a system that uses systemd:
sudo systemctl status postgresql
This will provide detailed information about the PostgreSQL service, including whether it is active (running) or inactive (stopped).
