diff options
author | Bruce Momjian | 2004-12-02 22:48:10 +0000 |
---|---|---|
committer | Bruce Momjian | 2004-12-02 22:48:10 +0000 |
commit | 9269699b9d232f26765274d2dc99807307cbcf70 (patch) | |
tree | 4e0e4781f58b941e29ed24d5e72fa722f0432660 | |
parent | 12e678201d050ebedda21144ff0f10a34bb48e4a (diff) |
> > 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 for
beta3, so you should not be seeing this issue unless you actually have
an older version for some reason.
http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pg_autovacuum/p
g_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), more
that it doesn't re-add them when it writes the command line in the
registry. The attached patch fixes that by simply quoting all options
that 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
-rw-r--r-- | contrib/pg_autovacuum/README.pg_autovacuum | 9 | ||||
-rw-r--r-- | contrib/pg_autovacuum/pg_autovacuum.c | 18 | ||||
-rw-r--r-- | contrib/pg_autovacuum/pg_autovacuum.h | 3 |
3 files changed, 21 insertions, 9 deletions
diff --git a/contrib/pg_autovacuum/README.pg_autovacuum b/contrib/pg_autovacuum/README.pg_autovacuum index 88a8997b164..00da36db733 100644 --- a/contrib/pg_autovacuum/README.pg_autovacuum +++ b/contrib/pg_autovacuum/README.pg_autovacuum @@ -163,12 +163,17 @@ The following arguments are used on Windows only: be stored in plain text. -N service user: Name of the Windows user account under which the service - will run. + will run. Only used when installing as a Windows service. --W service password: The password for the service account. +-W service password: The password for the service account.Only used when + installing as a Windows service. -R Uninstall pg_autovacuum as a service. +-E Dependent service that must start before this service. Normally this will be + a PostgreSQL instance, e.g. "-E pgsql-8.0.0". Only used when installing as + a Windows service. + Vacuum and Analyze: ------------------- diff --git a/contrib/pg_autovacuum/pg_autovacuum.c b/contrib/pg_autovacuum/pg_autovacuum.c index c08911d6a6d..8053b647ce6 100644 --- a/contrib/pg_autovacuum/pg_autovacuum.c +++ b/contrib/pg_autovacuum/pg_autovacuum.c @@ -4,7 +4,7 @@ * Revisions by Christopher B. Browne, Liberty RMS * Win32 Service code added by Dave Page * - * $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.26 2004/12/02 20:31:17 momjian Exp $ + * $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.27 2004/12/02 22:48:10 momjian Exp $ */ #include "postgres_fe.h" @@ -1100,7 +1100,7 @@ get_cmd_args(int argc, char *argv[]) #ifndef WIN32 while ((c = getopt(argc, argv, "s:S:v:V:a:A:d:U:P:H:L:p:hDc:C:m:n:l:")) != -1) #else - 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) + 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) #endif { switch (c) @@ -1165,6 +1165,9 @@ get_cmd_args(int argc, char *argv[]) usage(); exit(0); #ifdef WIN32 + case 'E': + args->service_dependencies = optarg; + break; case 'I': args->install_as_service++; break; @@ -1216,6 +1219,7 @@ usage(void) fprintf(stderr, " [-R] Remove as a Windows service (all other options will be ignored)\n"); fprintf(stderr, " [-N] Username to run service as (only useful when installing as a Windows service)\n"); fprintf(stderr, " [-W] Password to run service with (only useful when installing as a Windows service)\n"); + fprintf(stderr, " [-E] Dependent service that must start before this service (only useful when installing as a Windows service)\n"); #endif i = AUTOVACUUM_DEBUG; fprintf(stderr, " [-d] debug (debug level=0,1,2,3; default=%d)\n", i); @@ -1273,6 +1277,8 @@ print_cmd_args(void) log_entry(logbuffer, LVL_INFO); sprintf(logbuffer, " args->remove_as_service=%d", args->remove_as_service); log_entry(logbuffer, LVL_INFO); + sprintf(logbuffer, " args->service_dependencies=%s", (args->service_dependencies) ? args->service_dependencies : "(null)"); + log_entry(logbuffer, LVL_INFO); sprintf(logbuffer, " args->service_user=%s", (args->service_user) ? args->service_user : "(null)"); log_entry(logbuffer, LVL_INFO); sprintf(logbuffer, " args->service_password=%s", (args->service_password) ? args->service_password : "(null)"); @@ -1385,7 +1391,7 @@ InstallService() szFilename, /* Service binary */ NULL, /* No load ordering group */ NULL, /* No tag identifier */ - NULL, /* Dependencies */ + args->service_dependencies, /* Dependencies */ args->service_user, /* Service account */ args->service_password); /* Account password */ @@ -1406,11 +1412,11 @@ InstallService() if (args->port) sprintf(szCommand, "%s -p %s", szCommand, args->port); if (args->user) - sprintf(szCommand, "%s -U %s", szCommand, args->user); + sprintf(szCommand, "%s -U \"%s\"", szCommand, args->user); if (args->password) - sprintf(szCommand, "%s -P %s", szCommand, args->password); + sprintf(szCommand, "%s -P \"%s\"", szCommand, args->password); if (args->logfile) - sprintf(szCommand, "%s -L %s", szCommand, args->logfile); + sprintf(szCommand, "%s -L \"%s\"", szCommand, args->logfile); if (args->sleep_base_value != (int) SLEEPBASEVALUE) sprintf(szCommand, "%s -s %d", szCommand, args->sleep_base_value); if (args->sleep_scaling_factor != (float) SLEEPSCALINGFACTOR) diff --git a/contrib/pg_autovacuum/pg_autovacuum.h b/contrib/pg_autovacuum/pg_autovacuum.h index 02933fbc82d..d9e476ed6a9 100644 --- a/contrib/pg_autovacuum/pg_autovacuum.h +++ b/contrib/pg_autovacuum/pg_autovacuum.h @@ -2,7 +2,7 @@ * Header file for pg_autovacuum.c * (c) 2003 Matthew T. O'Connor * - * $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.h,v 1.13 2004/11/17 16:54:15 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.h,v 1.14 2004/12/02 22:48:10 momjian Exp $ */ #ifndef _PG_AUTOVACUUM_H @@ -68,6 +68,7 @@ typedef struct cmdargs char *user, *password, #ifdef WIN32 + *service_dependencies, *service_user, *service_password, #endif |