How can I tell if my Postgresql server is running or not?
I\'m getting this message:
[~/dev/working/sw] sudo bundle exec rake db:migrate
rake aborte
The pg_ctl status command suggested in other answers checks that the postmaster process exists and if so reports that it's running. That doesn't necessarily mean it is ready to accept connections or execute queries.
It is better to use another method like using psql to run a simple query and checking the exit code, e.g. psql -c 'SELECT 1', or use pg_isready to check the connection status.