From 088c0b9546e4f90f305a87bc67638836a08d34ed Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 8 Feb 2001 19:39:24 +0000 Subject: [PATCH] Make -w the default for shut down, add -W option to specify no wait. Add -l option to name log file. Set umask to 077. Proper file descriptor redirection to allow postmaster to detach from shell's process group. Add -s option to turn off informational messages. --- doc/src/sgml/ref/pg_ctl-ref.sgml | 188 ++++++++++++++------------ src/bin/pg_ctl/pg_ctl.sh | 218 ++++++++++++++++++++----------- 2 files changed, 244 insertions(+), 162 deletions(-) diff --git a/doc/src/sgml/ref/pg_ctl-ref.sgml b/doc/src/sgml/ref/pg_ctl-ref.sgml index 7b628ead93..617a070d6e 100644 --- a/doc/src/sgml/ref/pg_ctl-ref.sgml +++ b/doc/src/sgml/ref/pg_ctl-ref.sgml @@ -1,11 +1,11 @@ - 2000-11-25 + 2001-02-08 @@ -25,12 +25,13 @@ Postgres documentation start -w -D datadir - -p path + -l filename -o options + -p path pg_ctl stop - -w + -W -D datadir -m @@ -64,8 +65,52 @@ Postgres documentation Description pg_ctl is a utility for starting, - stopping, or restarting the , or - displaying the status of a running postmaster. + stopping, or restarting , the + PostgreSQL backend server, or displaying + the status of a running postmaster. Although the postmaster can be + started manually, pg_ctl encapulates + tasks such as redirecting log output, properly detaching from the + terminal and process group, and additionally provides an option for + controlled shut down. + + + + In mode, a new postmaster is launched. The + server is started in the background, the standard input attached to + /dev/null. The standard output and standard + error are either appended to a log file, if the + option is used, or are redirected to + pg_ctl's standard output (not standard + error). If no log file is chosen, the standard output of + pg_ctl should be redirected to a file or + piped to another process, for example a log rotating program, + otherwise the postmaster will write its output the the controlling + terminal (from the background) and will not leave the shell's + process group. + + + + In mode, the postmaster that is running on + the specified data directory is shut down. Three different + shutdown methods can be selected with the + option: Smart mode waits for all the clients to + disconnect. This is the default. Fast mode does + not wait for clients to disconnect. All active transactions will + be rolled back. Immediate mode will abort without + complete shutdown. This will lead to a recovery run on restart. + By the default, stop mode waits for the shutdown to complete. + + + + mode effectively executes a stop followed + by a start. This allows the changing of postmaster command line + options. + + + + mode checks whether a postmaster is running + and if so displays the PID and the command line + options that were used to invoke it. @@ -73,18 +118,6 @@ Postgres documentation - - -w - - - Wait for the database server to come up, by watching for - creation of the pid file - (PGDATA/postmaster.pid). - Times out after 60 seconds. - - - - -D datadir @@ -97,15 +130,25 @@ Postgres documentation - -p path + -l filename - Specifies the location of the postmaster - executable. By default the postmaster 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 postmaster was not found. + Append the server log output to + filename. If the file does not + exist, it is created. The umask is set to 077, so access to + the log file from other users is disallowed by default. + + + + + + -m mode + + + Specifies the shutdown mode. mode + may be smart, fast, or + immediate, or the first letter of one of + these three. @@ -125,82 +168,35 @@ Postgres documentation - -m mode + -p path - Specifies the shutdown mode. - - - - smart - s - - - Smart mode waits for all the clients to disconnect. This - is the default. - - - - - - fast - f - - - Fast mode does not wait for clients to disconnect. All - active transactions will be rolled back. - - - - - - immediate - i - - - Immediate mode will abort without complete shutdown. This - will lead to a recovery run on restart. - - - - + Specifies the location of the postmaster + executable. By default the postmaster 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 postmaster was not found. - start + -w - Start up postmaster. + Wait for the start or stutdown to complete. Times out after + 60 seconds. This is the default for shutdowns. - stop + -W - Shut down postmaster. - - - - - - restart - - - Stop the postmaster, if one is running, - and then start it again. - - - - - - status - - - Show the current state of postmaster. + Do not wait for start or shutdown to complete. This is the + default for starts and restarts. @@ -223,7 +219,7 @@ Postgres documentation - Usage + Examples Starting the postmaster @@ -260,7 +256,6 @@ Postgres documentation stops postmaster. Using the switch allows one to control how the backend shuts down. - waits for postmaster to shut down. @@ -312,6 +307,25 @@ Command line was: + + + Bugs + + + Waiting for complete start is not a well-defined operation and may + fail if access control is set up in way that a local client cannot + connect without manual interaction. It should be avoided. + + + + + See Also + + + , PostgreSQL Administrator's Guide + + +