From: Magnus Hagander Date: Thu, 9 Jun 2011 16:18:45 +0000 (+0200) Subject: Support silent mode for service registrations on win32 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=9c04b889966a24c2c021039ba29b30bc7592994c;p=users%2Fc2main%2Fpostgres.git Support silent mode for service registrations on win32 Using -s when registering a service will now suppress the application eventlog entries stating that the service is starting and started. MauMau --- diff --git a/doc/src/sgml/ref/pg_ctl-ref.sgml b/doc/src/sgml/ref/pg_ctl-ref.sgml index c4eae62356..6ee18d406e 100644 --- a/doc/src/sgml/ref/pg_ctl-ref.sgml +++ b/doc/src/sgml/ref/pg_ctl-ref.sgml @@ -91,6 +91,7 @@ PostgreSQL documentation -D datadir -w -t seconds + -s -o options diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c index 92fc1f2830..448bb77be4 100644 --- a/src/bin/pg_ctl/pg_ctl.c +++ b/src/bin/pg_ctl/pg_ctl.c @@ -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, " ");