2

I need to test a connection to a distant postgres database with SSL turned on, and be notified of the result. I have the following command:

psql "sslmode=verify-ca sslrootcert=myRootCert.crt sslcert=myPublicCert.crt sslkey=myPrivateKey.key hostaddr=host user=user port=port dbname=db password=passwd"

It works fine, I am logged in and I can start typing commands. But what I need is only the status of the connection test, I don't want to be logged in after.

I saw there is a pg_isready command, but I can not find how to use it with SSL.

1 Answer 1

3

You can use your connection string like this:

pg_isready -d 'sslmode=verify-ca sslrootcert=myRootCert.crt sslcert=myPublicCert.crt sslkey=myPrivateKey.key hostaddr=host user=user port=port dbname=db password=passwd'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.