0. Help
$/home/lhl/az/pg/bin/pg_ctl--Helppg_ctl is a utility to initialize, start, stop, or control a PostgreSQL server. Usage:pg_ctl INIT[DB] [-D DataDir] [-S] [-O"OPTIONS"] Pg_ctl start [-W] [-t SECS] [-D datadir] [-S] [-l FILENAME] [-O"OPTIONS"] Pg_ctl Stop [-W] [-t SECS] [-D datadir] [-S] [-M shutdown-MODE] pg_ctl restart [-W] [-t SECS] [-D datadir] [-S] [-M shutdown-MODE] [-O"OPTIONS"] Pg_ctl Reload [-D DataDir] [-s] pg_ctl status [-D DataDir] Pg_ctl promote [-D DataDir] [-S] Pg_ctlKillsignalname Pidcommon Options:-D,--pgdata=DataDir location of the database storage Area-S,--Silent only print errors, no informational messages-T,--timeout=secs seconds towaitWhen using-Woption-V,--version output version information, ThenExit-W wait untilOperation completes-W DoNotwait untilOperation completes-?,--Help show this help, Thenexit (the default is towait forShutdown, but not forstart or restart.) If the- D option is omitted, and the environment variable PGDATA is used. Options forStart or restart:-C,--core-files allow Postgres to produce core files-L,--log=filenameWrite(or append) server log to FILENAME-o Options command line OPTIONS-to-pass to Postgres (PostgreSQL server executable) or Initdb-P path-to-POSTGRES normally not necessaryoptions forStop or restart:-M,--mode=mode mode can be"Smart","Fast", or"Immediate"Shutdown modes Are:smart quit after all clients has disconnected fast quit directly, with proper shut Down immediate quit without complete shutdown; would leads to recovery on restart
1. Installation2. Start
Pg_ctl start-d Pgdata
3. Close
Pg_ctl stop-D pgdata
-M fast-d Pgdata
4. Deadlock Handling
Reference
PostgreSQL operation and Maintenance