On Thu, Aug 19, 2010 at 03:47:43PM -0400, Alvaro Herrera wrote:
> Excerpts from David Fetter's message of jue ago 19 11:48:53 -0400 2010:
>
> > + <varlistentry>
> > + <term><option>-S <replaceable
> > class="parameter"></replaceable></option></term>
>
> You omitted the start-type inside the <replaceable> tag. Also, the "a"
> and "d" values seem to be accepted but not documented.
D'oh! Changed patch enclosed. Now in context format :)
Cheers,
David.
--
David Fetter <[email protected]> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: [email protected]
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
*** a/doc/src/sgml/ref/pg_ctl-ref.sgml
--- b/doc/src/sgml/ref/pg_ctl-ref.sgml
***************
*** 96,101 **** PostgreSQL documentation
--- 96,107 ----
<arg>-U <replaceable>username</replaceable></arg>
<arg>-P <replaceable>password</replaceable></arg>
<arg>-D <replaceable>datadir</replaceable></arg>
+ <arg>-S
+ <group choice="plain">
+ <arg>a[uto]</arg>
+ <arg>d[emand]</arg>
+ </group>
+ </arg>
<arg>-w</arg>
<arg>-t <replaceable>seconds</replaceable></arg>
<arg>-o <replaceable>options</replaceable></arg>
***************
*** 377,382 **** PostgreSQL documentation
--- 383,400 ----
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><option>-S <replaceable
class="parameter">start-type</replaceable></option></term>
+ <listitem>
+ <para>
+ Start type of the system service to register. start-type can
+ be <literal>auto</literal>, or <literal>demand</literal>, or
+ the first letter of one of these two. If this is omitted,
+ <literal>auto</literal> is used.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect2>
*** a/src/bin/pg_ctl/pg_ctl.c
--- b/src/bin/pg_ctl/pg_ctl.c
***************
*** 69,74 **** typedef enum
--- 69,82 ----
RUN_AS_SERVICE_COMMAND
} CtlCommand;
+
+ typedef enum
+ {
+ PGCTL_START_AUTO,
+ PGCTL_START_DEMAND
+ } PgctlWin32StartType;
+
+
#define DEFAULT_WAIT 60
static bool do_wait = false;
***************
*** 87,92 **** static char *exec_path = NULL;
--- 95,101 ----
static char *register_servicename = "PostgreSQL"; /* FIXME: +
version ID? */
static char *register_username = NULL;
static char *register_password = NULL;
+ static PgctlWin32StartType win32_start_type = PGCTL_START_AUTO;
static char *argv0 = NULL;
static bool allow_core_files = false;
***************
*** 1132,1137 **** pgwin32_doRegister(void)
--- 1141,1147 ----
{
SC_HANDLE hService;
SC_HANDLE hSCM = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+ DWORD starttype;
if (hSCM == NULL)
{
***************
*** 1145,1153 **** pgwin32_doRegister(void)
exit(1);
}
if ((hService = CreateService(hSCM, register_servicename,
register_servicename,
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,
!
SERVICE_AUTO_START, SERVICE_ERROR_NORMAL,
pgwin32_CommandLine(true),
NULL, NULL, "RPCSS\0", register_username, register_password)) ==
NULL)
{
--- 1155,1168 ----
exit(1);
}
+ if (win32_start_type == PGCTL_START_AUTO)
+ starttype = SERVICE_AUTO_START;
+ else
+ starttype = SERVICE_DEMAND_START;
+
if ((hService = CreateService(hSCM, register_servicename,
register_servicename,
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,
! starttype,
SERVICE_ERROR_NORMAL,
pgwin32_CommandLine(true),
NULL, NULL, "RPCSS\0", register_username, register_password)) ==
NULL)
{
***************
*** 1586,1592 **** do_help(void)
printf(_(" %s kill SIGNALNAME PID\n"), progname);
#if defined(WIN32) || defined(__CYGWIN__)
printf(_(" %s register [-N SERVICENAME] [-U USERNAME] [-P PASSWORD]
[-D DATADIR]\n"
! " [-w] [-t SECS] [-o \"OPTIONS\"]\n"),
progname);
printf(_(" %s unregister [-N SERVICENAME]\n"), progname);
#endif
--- 1601,1607 ----
printf(_(" %s kill SIGNALNAME PID\n"), progname);
#if defined(WIN32) || defined(__CYGWIN__)
printf(_(" %s register [-N SERVICENAME] [-U USERNAME] [-P PASSWORD]
[-D DATADIR]\n"
! " [-S START-TYPE] [-w] [-t SECS] [-o
\"OPTIONS\"]\n"), progname);
printf(_(" %s unregister [-N SERVICENAME]\n"), progname);
#endif
***************
*** 1627,1632 **** do_help(void)
--- 1642,1654 ----
printf(_(" -N SERVICENAME service name with which to register
PostgreSQL server\n"));
printf(_(" -P PASSWORD password of account to register PostgreSQL
server\n"));
printf(_(" -U USERNAME user name of account to register PostgreSQL
server\n"));
+ printf(_(" -S START-TYPE service start type to register PostgreSQL
server,\n"
+ " can be auto or demand\n"));
+
+ printf(_("\nStart types are:\n"));
+ printf(_(" auto service start automatically during system
startup\n"));
+ printf(_(" demand service start on demand\n"));
+
#endif
printf(_("\nReport bugs to <[email protected]>.\n"));
***************
*** 1696,1701 **** set_sig(char *signame)
--- 1718,1742 ----
+ #if defined(WIN32) || defined(__CYGWIN__)
+ static void
+ set_starttype(char *starttypeopt)
+ {
+ if (strcmp(starttypeopt, "a") == 0 || strcmp(starttypeopt, "auto") == 0)
+ win32_start_type = PGCTL_START_AUTO;
+ else if (strcmp(starttypeopt, "d") == 0 || strcmp(starttypeopt,
"demand") == 0)
+ win32_start_type = PGCTL_START_DEMAND;
+ else
+ {
+ write_stderr(_("%s: unrecognized start type \"%s\"\n"),
progname, starttypeopt);
+ do_advice();
+ exit(1);
+ }
+ }
+ #endif
+
+
+
int
main(int argc, char **argv)
{
***************
*** 1772,1778 **** main(int argc, char **argv)
/* process command-line options */
while (optind < argc)
{
! while ((c = getopt_long(argc, argv, "cD:l:m:N:o:p:P:st:U:wW",
long_options, &option_index)) != -1)
{
switch (c)
{
--- 1813,1819 ----
/* process command-line options */
while (optind < argc)
{
! while ((c = getopt_long(argc, argv, "cD:l:m:N:o:p:P:sS:t:U:wW",
long_options, &option_index)) != -1)
{
switch (c)
{
***************
*** 1819,1824 **** main(int argc, char **argv)
--- 1860,1870 ----
case 's':
silent_mode = true;
break;
+ #if defined(WIN32) || defined(__CYGWIN__)
+ case 'S':
+ set_starttype(optarg);
+ break;
+ #endif
case 't':
wait_seconds = atoi(optarg);
break;
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers