Support silent mode for service registrations on win32
authorMagnus Hagander
Thu, 9 Jun 2011 16:18:45 +0000 (18:18 +0200)
committerMagnus Hagander
Thu, 9 Jun 2011 16:24:59 +0000 (18:24 +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 ba2646c4c441110d16cff433f9ba6486d2728354..10105e2524109c25a5347cfd1f8493ce3d6c6c51 100644 (file)
@@ -117,6 +117,7 @@ PostgreSQL documentation
    
    -w
    -t seconds
+   -s
    -o options
   
 
index e203c1299d03a3272ade1dfd924f59c16ca58906..78f4cd3e54f28d92a8ff028df72946f56e16df76 100644 (file)
@@ -163,6 +163,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");
@@ -1276,6 +1279,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, " ");