Skip to content

Commit 15fe829

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 ffa653b commit 15fe829

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
@@ -104,6 +104,7 @@ PostgreSQL documentation
104104
<arg>-D <replaceable>datadir</replaceable></arg>
105105
<arg>-w</arg>
106106
<arg>-t <replaceable>seconds</replaceable></arg>
107+
<arg>-s</arg>
107108
<arg>-o <replaceable>options</replaceable></arg>
108109
</cmdsynopsis>
109110

src/bin/pg_ctl/pg_ctl.c

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

158+
if (silent_mode && level == EVENTLOG_INFORMATION_TYPE)
159+
return;
160+
158161
if (evtHandle == INVALID_HANDLE_VALUE)
159162
{
160163
evtHandle = RegisterEventSource(NULL, "PostgreSQL");
@@ -1131,6 +1134,9 @@ pgwin32_CommandLine(bool registration)
11311134
/* concatenate */
11321135
sprintf(cmdLine + strlen(cmdLine), " -t %d", wait_seconds);
11331136

1137+
if (registration && silent_mode)
1138+
strcat(cmdLine, " -s");
1139+
11341140
if (post_opts)
11351141
{
11361142
strcat(cmdLine, " ");

0 commit comments

Comments
 (0)