简体   繁体   中英

Start Postgres DB if needed with pg_ctl

I know that I can start a Postgres DB using pg_ctl start -D $DBPATH , but that'll throw if the DB is already started. How do I start the DB only if it's not already running? Relatedly, how do I check if the DB is already running from only the file system?

For that, use

pg_ctl status -D $DBPATH

See the documentation for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM