Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6e414a1

Browse files
committed
Add pg_ctl -t/timeout parameter to control amount of time to wait for
start/shutdown.
1 parent c6722d7 commit 6e414a1

File tree

2 files changed

+36
-8
lines changed

2 files changed

+36
-8
lines changed

doc/src/sgml/ref/pg_ctl-ref.sgml

+26-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.43 2007/11/10 14:07:18 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_ctl-ref.sgml,v 1.44 2007/11/10 21:48:51 momjian Exp $
33
PostgreSQL documentation
44
-->
55

@@ -21,19 +21,23 @@ PostgreSQL documentation
2121

2222
<refsynopsisdiv>
2323
<cmdsynopsis>
24+
2425
<command>pg_ctl</command>
2526
<arg choice="plain">start</arg>
2627
<arg>-w</arg>
28+
<arg>-t <replaceable>seconds</replaceable></arg>
2729
<arg>-s</arg>
2830
<arg>-D <replaceable>datadir</replaceable></arg>
2931
<arg>-l <replaceable>filename</replaceable></arg>
3032
<arg>-o <replaceable>options</replaceable></arg>
3133
<arg>-p <replaceable>path</replaceable></arg>
3234
<arg>-c</arg>
3335
<sbr>
36+
3437
<command>pg_ctl</command>
3538
<arg choice="plain">stop</arg>
3639
<arg>-W</arg>
40+
<arg>-t <replaceable>seconds</replaceable></arg>
3741
<arg>-s</arg>
3842
<arg>-D <replaceable>datadir</replaceable></arg>
3943
<arg>-m
@@ -44,9 +48,11 @@ PostgreSQL documentation
4448
</group>
4549
</arg>
4650
<sbr>
51+
4752
<command>pg_ctl</command>
4853
<arg choice="plain">restart</arg>
4954
<arg>-w</arg>
55+
<arg>-t <replaceable>seconds</replaceable></arg>
5056
<arg>-s</arg>
5157
<arg>-D <replaceable>datadir</replaceable></arg>
5258
<arg>-c</arg>
@@ -59,32 +65,39 @@ PostgreSQL documentation
5965
</arg>
6066
<arg>-o <replaceable>options</replaceable></arg>
6167
<sbr>
68+
6269
<command>pg_ctl</command>
6370
<arg choice="plain">reload</arg>
6471
<arg>-s</arg>
6572
<arg>-D <replaceable>datadir</replaceable></arg>
6673
<sbr>
74+
6775
<command>pg_ctl</command>
6876
<arg choice="plain">status</arg>
6977
<arg>-D <replaceable>datadir</replaceable></arg>
7078
<sbr>
79+
7180
<command>pg_ctl</command>
7281
<arg choice="plain">kill</arg>
7382
<arg><replaceable>signal_name</replaceable></arg>
7483
<arg><replaceable>process_id</replaceable></arg>
7584
<sbr>
85+
7686
<command>pg_ctl</command>
7787
<arg choice="plain">register</arg>
7888
<arg>-N <replaceable>servicename</replaceable></arg>
7989
<arg>-U <replaceable>username</replaceable></arg>
8090
<arg>-P <replaceable>password</replaceable></arg>
8191
<arg>-D <replaceable>datadir</replaceable></arg>
8292
<arg>-w</arg>
93+
<arg>-t <replaceable>seconds</replaceable></arg>
8394
<arg>-o <replaceable>options</replaceable></arg>
8495
<sbr>
96+
8597
<command>pg_ctl</command>
8698
<arg choice="plain">unregister</arg>
8799
<arg>-N <replaceable>servicename</replaceable></arg>
100+
88101
</cmdsynopsis>
89102
</refsynopsisdiv>
90103

@@ -261,12 +274,22 @@ PostgreSQL documentation
261274
</listitem>
262275
</varlistentry>
263276

277+
<varlistentry>
278+
<term><option>-t</option></term>
279+
<listitem>
280+
<para>
281+
The number of seconds to wait when waiting for start or shutdown
282+
to complete.
283+
</para>
284+
</listitem>
285+
</varlistentry>
286+
264287
<varlistentry>
265288
<term><option>-w</option></term>
266289
<listitem>
267290
<para>
268-
Wait for the start or shutdown to complete. Times out after
269-
60 seconds. This is the default for shutdowns. A successful
291+
Wait for the start or shutdown to complete. The default wait time
292+
is 60 seconds. This is the default option for shutdowns. A successful
270293
shutdown is indicated by removal of the <acronym>PID</acronym>
271294
file. For starting up, a successful <command>psql -l</command>
272295
indicates success. <command>pg_ctl</command> will attempt to

src/bin/pg_ctl/pg_ctl.c

+10-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.85 2007/10/31 10:55:25 petere Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.86 2007/11/10 21:48:51 momjian Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -1465,21 +1465,22 @@ do_help(void)
14651465
printf(_("%s is a utility to start, stop, restart, reload configuration files,\n"
14661466
"report the status of a PostgreSQL server, or signal a PostgreSQL process.\n\n"), progname);
14671467
printf(_("Usage:\n"));
1468-
printf(_(" %s start [-w] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]\n"), progname);
1468+
printf(_(" %s start [-w] [-t secs] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]\n"), progname);
14691469
printf(_(" %s stop [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n"), progname);
1470-
printf(_(" %s restart [-w] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] [-o \"OPTIONS\"]\n"), progname);
1470+
printf(_(" %s restart [-w] [-t secs] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n [-o \"OPTIONS\"]\n"), progname);
14711471
printf(_(" %s reload [-D DATADIR] [-s]\n"), progname);
14721472
printf(_(" %s status [-D DATADIR]\n"), progname);
14731473
printf(_(" %s kill SIGNALNAME PID\n"), progname);
14741474
#if defined(WIN32) || defined(__CYGWIN__)
14751475
printf(_(" %s register [-N SERVICENAME] [-U USERNAME] [-P PASSWORD] [-D DATADIR]\n"
1476-
" [-w] [-o \"OPTIONS\"]\n"), progname);
1476+
" [-w] [-t timeout] [-o \"OPTIONS\"]\n"), progname);
14771477
printf(_(" %s unregister [-N SERVICENAME]\n"), progname);
14781478
#endif
14791479

14801480
printf(_("\nCommon options:\n"));
14811481
printf(_(" -D, --pgdata DATADIR location of the database storage area\n"));
14821482
printf(_(" -s, --silent only print errors, no informational messages\n"));
1483+
printf(_(" -t secs seconds to wait when using -w option\n"));
14831484
printf(_(" -w wait until operation completes\n"));
14841485
printf(_(" -W do not wait until operation completes\n"));
14851486
printf(_(" --help show this help, then exit\n"));
@@ -1592,6 +1593,7 @@ main(int argc, char **argv)
15921593
{"mode", required_argument, NULL, 'm'},
15931594
{"pgdata", required_argument, NULL, 'D'},
15941595
{"silent", no_argument, NULL, 's'},
1596+
{"timeout", required_argument, NULL, 't'},
15951597
{"core-files", no_argument, NULL, 'c'},
15961598
{NULL, 0, NULL, 0}
15971599
};
@@ -1657,7 +1659,7 @@ main(int argc, char **argv)
16571659
/* process command-line options */
16581660
while (optind < argc)
16591661
{
1660-
while ((c = getopt_long(argc, argv, "cD:l:m:N:o:p:P:sU:wW", long_options, &option_index)) != -1)
1662+
while ((c = getopt_long(argc, argv, "cD:l:m:N:o:p:P:st:U:wW", long_options, &option_index)) != -1)
16611663
{
16621664
switch (c)
16631665
{
@@ -1704,6 +1706,9 @@ main(int argc, char **argv)
17041706
case 's':
17051707
silent_mode = true;
17061708
break;
1709+
case 't':
1710+
wait_seconds = atoi(optarg);
1711+
break;
17071712
case 'U':
17081713
if (strchr(optarg, '\\'))
17091714
register_username = xstrdup(optarg);

0 commit comments

Comments
 (0)