Support silent mode for service registrations on win32
authorMagnus Hagander <[email protected]>
Thu, 9 Jun 2011 16:18:45 +0000 (18:18 +0200)
committerMagnus Hagander <[email protected]>
Thu, 9 Jun 2011 16:28:04 +0000 (18:28 +0200)
Using -s when registering a service will now suppress
the application eventlog entries stating that the service
is starting and started.

MauMau

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

index c4eae62356038f56f3c8e6ba3a0a7429f38eb925..6ee18d406e74526b3ac3c4f5d2aed605fce222f8 100644 (file)
@@ -91,6 +91,7 @@ PostgreSQL documentation
    <arg>-D <replaceable>datadir</replaceable></arg>
    <arg>-w</arg>
    <arg>-t <replaceable>seconds</replaceable></arg>
+   <arg>-s</arg>
    <arg>-o <replaceable>options</replaceable></arg>
    <sbr>
 
index 92fc1f28302d1989b8ffdd17a5c8cbecaa3da1e9..448bb77be4950d727819a3e1a36aa8b5bfda8b42 100644 (file)
@@ -159,6 +159,9 @@ write_eventlog(int level, const char *line)
 {
        static HANDLE evtHandle = INVALID_HANDLE_VALUE;
 
+       if (silent_mode && level == EVENTLOG_INFORMATION_TYPE)
+               return;
+
        if (evtHandle == INVALID_HANDLE_VALUE)
        {
                evtHandle = RegisterEventSource(NULL, "PostgreSQL");
@@ -1065,6 +1068,9 @@ pgwin32_CommandLine(bool registration)
                /* concatenate */
                sprintf(cmdLine + strlen(cmdLine), " -t %d", wait_seconds);
 
+       if (registration && silent_mode)
+               strcat(cmdLine, " -s");
+
        if (post_opts)
        {
                strcat(cmdLine, " ");