Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9269699

Browse files
committed
> > 8.0beta3 has pg_autovacuum included, when I want to run this as a
> > Windows service, it says you can use the -I and -R options.> >> > When I do that and I specify a password with '-P'> (uppercase) then in> > the registry it's saved as '-p' (lowercase) in the> service-commandline> > (ImagePath).This was fixed in v1.21 of pg_autovacuum.c, That rev is tagged forbeta3, so you should not be seeing this issue unless you actually havean older version for some reason.http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pg_autovacuum/pg_autovacuum.c.diff?r1=1.20;r2=1.21;f=h> > Also it removes the quotes I added and I'm not so sure it> would work> > the way it's supposed to, without it.It's not so much that it strips them (that happens automagically), morethat it doesn't re-add them when it writes the command line in theregistry. The attached patch fixes that by simply quoting all optionsthat may need it.> > If you add DependOnService (a REG_MULTI_SZ an> array-like-thingie) and> > have the name (in this case: pgsql-8.0-beta2-dev3) of a service it> > depends on, it will not fail to start (it will not even try, as> > PostgreSQL is not running), when PostgreSQL already failed.> >> > Maybe it's an idea to specify it on the commandline (what> service to> > depend on).A -E <service> option is added in the attached patch.Dave Page
1 parent12e6782 commit9269699

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

‎contrib/pg_autovacuum/README.pg_autovacuum

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,17 @@ The following arguments are used on Windows only:
163163
be stored in plain text.
164164

165165
-N service user: Name of the Windows user account under which the service
166-
will run.
166+
will run. Only used when installing as a Windows service.
167167

168-
-W service password: The password for the service account.
168+
-W service password: The password for the service account.Only used when
169+
installing as a Windows service.
169170

170171
-R Uninstall pg_autovacuum as a service.
171172

173+
-E Dependent service that must start before this service. Normally this will be
174+
a PostgreSQL instance, e.g. "-E pgsql-8.0.0". Only used when installing as
175+
a Windows service.
176+
172177
Vacuum and Analyze:
173178
-------------------
174179

‎contrib/pg_autovacuum/pg_autovacuum.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Revisions by Christopher B. Browne, Liberty RMS
55
* Win32 Service code added by Dave Page
66
*
7-
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.26 2004/12/0220:31:17 momjian Exp $
7+
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.27 2004/12/0222:48:10 momjian Exp $
88
*/
99

1010
#include"postgres_fe.h"
@@ -1100,7 +1100,7 @@ get_cmd_args(int argc, char *argv[])
11001100
#ifndefWIN32
11011101
while ((c=getopt(argc,argv,"s:S:v:V:a:A:d:U:P:H:L:p:hDc:C:m:n:l:"))!=-1)
11021102
#else
1103-
while ((c=getopt(argc,argv,"s:S:v:V:a:A:d:U:P:H:L:p:hIRN:W:c:C:m:n:l:"))!=-1)
1103+
while ((c=getopt(argc,argv,"s:S:v:V:a:A:d:U:P:H:L:p:hIRN:W:E:c:C:m:n:l:"))!=-1)
11041104
#endif
11051105
{
11061106
switch (c)
@@ -1165,6 +1165,9 @@ get_cmd_args(int argc, char *argv[])
11651165
usage();
11661166
exit(0);
11671167
#ifdefWIN32
1168+
case'E':
1169+
args->service_dependencies=optarg;
1170+
break;
11681171
case'I':
11691172
args->install_as_service++;
11701173
break;
@@ -1216,6 +1219,7 @@ usage(void)
12161219
fprintf(stderr," [-R] Remove as a Windows service (all other options will be ignored)\n");
12171220
fprintf(stderr," [-N] Username to run service as (only useful when installing as a Windows service)\n");
12181221
fprintf(stderr," [-W] Password to run service with (only useful when installing as a Windows service)\n");
1222+
fprintf(stderr," [-E] Dependent service that must start before this service (only useful when installing as a Windows service)\n");
12191223
#endif
12201224
i=AUTOVACUUM_DEBUG;
12211225
fprintf(stderr," [-d] debug (debug level=0,1,2,3; default=%d)\n",i);
@@ -1273,6 +1277,8 @@ print_cmd_args(void)
12731277
log_entry(logbuffer,LVL_INFO);
12741278
sprintf(logbuffer," args->remove_as_service=%d",args->remove_as_service);
12751279
log_entry(logbuffer,LVL_INFO);
1280+
sprintf(logbuffer," args->service_dependencies=%s", (args->service_dependencies) ?args->service_dependencies :"(null)");
1281+
log_entry(logbuffer,LVL_INFO);
12761282
sprintf(logbuffer," args->service_user=%s", (args->service_user) ?args->service_user :"(null)");
12771283
log_entry(logbuffer,LVL_INFO);
12781284
sprintf(logbuffer," args->service_password=%s", (args->service_password) ?args->service_password :"(null)");
@@ -1385,7 +1391,7 @@ InstallService()
13851391
szFilename,/* Service binary */
13861392
NULL,/* No load ordering group */
13871393
NULL,/* No tag identifier */
1388-
NULL,/* Dependencies */
1394+
args->service_dependencies,/* Dependencies */
13891395
args->service_user,/* Service account */
13901396
args->service_password);/* Account password */
13911397

@@ -1406,11 +1412,11 @@ InstallService()
14061412
if (args->port)
14071413
sprintf(szCommand,"%s -p %s",szCommand,args->port);
14081414
if (args->user)
1409-
sprintf(szCommand,"%s -U%s",szCommand,args->user);
1415+
sprintf(szCommand,"%s -U\"%s\"",szCommand,args->user);
14101416
if (args->password)
1411-
sprintf(szCommand,"%s -P%s",szCommand,args->password);
1417+
sprintf(szCommand,"%s -P\"%s\"",szCommand,args->password);
14121418
if (args->logfile)
1413-
sprintf(szCommand,"%s -L%s",szCommand,args->logfile);
1419+
sprintf(szCommand,"%s -L\"%s\"",szCommand,args->logfile);
14141420
if (args->sleep_base_value!= (int)SLEEPBASEVALUE)
14151421
sprintf(szCommand,"%s -s %d",szCommand,args->sleep_base_value);
14161422
if (args->sleep_scaling_factor!= (float)SLEEPSCALINGFACTOR)

‎contrib/pg_autovacuum/pg_autovacuum.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Header file for pg_autovacuum.c
33
* (c) 2003 Matthew T. O'Connor
44
*
5-
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.h,v 1.13 2004/11/17 16:54:15 tgl Exp $
5+
* $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.h,v 1.14 2004/12/02 22:48:10 momjian Exp $
66
*/
77

88
#ifndef_PG_AUTOVACUUM_H
@@ -68,6 +68,7 @@ typedef struct cmdargs
6868
char*user,
6969
*password,
7070
#ifdefWIN32
71+
*service_dependencies,
7172
*service_user,
7273
*service_password,
7374
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp