postgresql_16:7.3.5.5 Examples
PostgreSQL 16 > Reference > PostgreSQL Server Applications > pg_ctl > Examples
Starting the Server
To start the server, waiting until the server is accepting connections: $ pg_ctl start
To start the server using port 5433, and running without fsync, use: $ pg_ctl -o "-F -p 5433" start
Stopping the Server
To stop the server, use: $ pg_ctl stop The -m option allows control over *how* the server shuts down: $ pg_ctl stop -m smart
Restarting the Server
Restarting the server is almost equivalent to stopping the server and starting it again, except that by default, pg_ctl saves and reuses the command line options that were passed to the previously-running instance. To restart the server using the same options as before, use: $ pg_ctl restart
But if -o is specified, that replaces any previous options. To restart using port 5433, disabling fsync upon restart: $ pg_ctl -o "-F -p 5433" restart
Showing the Server Status
Here is sample status output from pg_ctl: $ pg_ctl status pg_ctl: server is running (PID: 13718) /usr/local/pgsql/bin/postgres "-D" "/usr/local/pgsql/data" "-p" "5433" "-B" "128" The second line is the command that would be invoked in restart mode.