postgresql_16:7.3.5.2 Options
PostgreSQL 16 > Reference > PostgreSQL Server Applications > pg_ctl > Options
-c, --core-files
Attempt to allow server crashes to produce core files, on platforms where this is possible, by lifting any soft resource limit placed on core files. This is useful in debugging or diagnosing problems by allowing a stack trace to be obtained from a failed server process.
**-D *datadir*, --pgdata=*datadir***
Specifies the file system location of the database configuration files. If this option is omitted, the environment variable PGDATA is used.
**-l *filename*, --log=*filename***
Append the server log output to *filename*. If the file does not exist, it is created. By default, only the cluster owner can access the log file. If group access is enabled in the cluster, users in the same group as the cluster owner can also read it.
**-m *mode*, --mode=*mode***
Specifies the shutdown mode. *mode* can be smart, fast, or immediate, or the first letter of one of these three. If this option is omitted, fast is the default.
**-o *options*, --options=*options***
Specifies options to be passed directly to the postgres command. -o can be specified multiple times, with all the given options being passed through.
The *options* should usually be surrounded by single or double quotes to ensure that they are passed through as a group.
**-o *initdb-options*, --options=*initdb-options***
Specifies options to be passed directly to the initdb command. -o can be specified multiple times, with all the given options being passed through.
The *initdb-options* should usually be surrounded by single or double quotes to ensure that they are passed through as a group.
**-p *path***
Specifies the location of the postgres executable. By default the postgres executable is taken from the same directory as pg_ctl, or failing that, the hard-wired installation directory. It is not necessary to use this option unless you are doing something unusual and get errors that the postgres executable was not found.
In init mode, this option analogously specifies the location of the initdb executable.
-s, --silent
Print only errors, no informational messages.
**-t *seconds*, --timeout=*seconds***
Specifies the maximum number of seconds to wait when waiting for an operation to complete (see option -w). Defaults to the value of the PGCTLTIMEOUT environment variable or, if not set, to 60 seconds.
-V, --version
Print the pg_ctl version and exit.
-w, --wait
Wait for the operation to complete. This is supported for the modes start, stop, restart, promote, and register, and is the default for those modes.
When waiting, pg_ctl repeatedly checks the server's PID file, sleeping for a short amount of time between checks. Startup is considered complete when the PID file indicates that the server is ready to accept connections. Shutdown is considered complete when the server removes the PID file. pg_ctl returns an exit code based on the success of the startup or shutdown.
If the operation does not complete within the timeout (see option -t), then pg_ctl exits with a nonzero exit status. But note that the operation might continue in the background and eventually succeed.
-W, --no-wait
Do not wait for the operation to complete. This is the opposite of the option -w.
If waiting is disabled, the requested action is triggered, but there is no feedback about its success. In that case, the server log file or an external monitoring system would have to be used to check the progress and success of the operation.
In prior releases of PostgreSQL, this was the default except for the stop mode.
-?, --help
Show help about pg_ctl command line arguments, and exit.
If an option is specified that is valid, but not relevant to the selected operating mode, pg_ctl ignores it.
Options for Windows
**-e *source***
Name of the event source for pg_ctl to use for logging to the event log when running as a Windows service. The default is PostgreSQL. Note that this only controls messages sent from pg_ctl itself; once started, the server will use the event source specified by its (see guc-event-source) parameter. Should the server fail very early in startup, before that parameter has been set, it might also log using the default event source name PostgreSQL.
**-N *servicename***
Name of the system service to register. This name will be used as both the service name and the display name. The default is PostgreSQL.
**-P *password***
Password for the user to run the service as.
**-S *start-type***
Start type of the system service. *start-type* can be auto, or demand, or the first letter of one of these two. If this option is omitted, auto is the default.
**-U *username***
User name for the user to run the service as. For domain users, use the format DOMAIN\username.