Skip to content

Commit 9c04b88

Browse files
committed
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
1 parent 302e4e6 commit 9c04b88

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ PostgreSQL documentation
9191
<arg>-D <replaceable>datadir</replaceable></arg>
9292
<arg>-w</arg>
9393
<arg>-t <replaceable>seconds</replaceable></arg>
94+
<arg>-s</arg>
9495
<arg>-o <replaceable>options</replaceable></arg>
9596
<sbr>
9697

src/bin/pg_ctl/pg_ctl.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ write_eventlog(int level, const char *line)
159159
{
160160
static HANDLE evtHandle = INVALID_HANDLE_VALUE;
161161

162+
if (silent_mode && level == EVENTLOG_INFORMATION_TYPE)
163+
return;
164+
162165
if (evtHandle == INVALID_HANDLE_VALUE)
163166
{
164167
evtHandle = RegisterEventSource(NULL, "PostgreSQL");
@@ -1065,6 +1068,9 @@ pgwin32_CommandLine(bool registration)
10651068
/* concatenate */
10661069
sprintf(cmdLine + strlen(cmdLine), " -t %d", wait_seconds);
10671070

1071+
if (registration && silent_mode)
1072+
strcat(cmdLine, " -s");
1073+
10681074
if (post_opts)
10691075
{
10701076
strcat(cmdLine, " ");

0 commit comments

Comments
 (0)