Re: [pgsql-hackers-win32] pg_autovacuum fails to start - 8.0 Release
"Dave Page" <[email protected]>
| Newsgroups | gmane.comp.db.postgresql.devel.patches,gmane.comp.db.postgresql.devel.win32 |
|---|---|
| Message-ID | <E7F85A1B5FF8D44C8A1AF6885BC9A0E4528581@ratbert.vale-housing.co.uk> |
> -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf > Of Harald Massa > Sent: 20 January 2005 13:30 > To: [email protected] > Subject: [pgsql-hackers-win32] pg_autovacuum fails to start - > 8.0 Release > > I am trying to install pg_autovacuum as a win32 service. > > pg_autovacuum -I -N ourdomain\postgres -W secretpassword -E > pgsql-8.0 -d 4 > -L c:\ghum\data\pg_log\autovacuum.log -U postgres -P > moresecretpasswords > > when trying to start: > > C:\Programme\PostgreSQL\8.0\bin>sc start pg_autovacuum > [SC] StartService FAILED 1075: > > Der Abhõngigkeitsdienst ist nicht vorhanden oder wurde zum > L÷schen markiert. > > (english: 1075 The dependency service does not exist or has > been marked for > deletion. ERROR_SERVICE_DEPENDENCY_DELETED) It appears I didn't read the docs properly when I write that bit - the dependencies parameter passed to CreateService() is supposed to be double-null terminated - a subtle point I missed :-( The attached patch fixes this. Harald - I can email an updated .exe if you want to test, otherwise, you should be able to use the current version if you cleanup the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\pg_autovacuum\DependOnService registry key. Regards, Dave ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
pg_autovacuum.c.diff
(application/octet-stream, 1.4 KB)
Index: pg_autovacuum.c
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v
retrieving revision 1.27
diff -u -r1.27 pg_autovacuum.c
--- pg_autovacuum.c 2 Dec 2004 22:48:10 -0000 1.27
+++ pg_autovacuum.c 20 Jan 2005 15:20:56 -0000
@@ -27,6 +27,7 @@
SERVICE_STATUS ServiceStatus;
SERVICE_STATUS_HANDLE hStatus;
int appMode = 0;
+char deps[255];
#endif
/* define atooid */
@@ -1073,6 +1074,7 @@
#ifndef WIN32
args->daemonize = 0;
#else
+ args->service_dependencies = 0;
args->install_as_service = 0;
args->remove_as_service = 0;
args->service_user = 0;
@@ -1166,7 +1168,9 @@
exit(0);
#ifdef WIN32
case 'E':
- args->service_dependencies = optarg;
+ ZeroMemory(deps, sizeof(deps));
+ snprintf(deps, sizeof(deps) - 2, "%s", optarg);
+ args->service_dependencies = (char *)deps;
break;
case 'I':
args->install_as_service++;
@@ -1359,7 +1363,7 @@
/* Register with the Service Control Manager */
static int
-InstallService()
+InstallService(void)
{
SC_HANDLE schService = NULL;
SC_HANDLE schSCManager = NULL;
@@ -1471,7 +1475,7 @@
/* Unregister from the Service Control Manager */
static int
-RemoveService()
+RemoveService(void)
{
SC_HANDLE schService = NULL;
SC_HANDLE schSCManager = NULL;