I have been getting this error recurrently when my server refuses connections. I usually did a fresh installation of postgres to delete all configuration files and restart the server but now its not working.
Here is a screenshot of the terminal using ps aux | grep postgres :