Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qjm3G-00C2wA-OI for pgsql-general@arkaria.postgresql.org; Fri, 22 Sep 2023 19:42:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qjm3F-00618V-6m for pgsql-general@arkaria.postgresql.org; Fri, 22 Sep 2023 19:42:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qjm3E-00618A-Qs for pgsql-general@lists.postgresql.org; Fri, 22 Sep 2023 19:42:56 +0000 Received: from hvs.heinz-it.de ([2a0d:5940:7:142::1000]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qjm3C-0064sN-1r for pgsql-general@lists.postgresql.org; Fri, 22 Sep 2023 19:42:55 +0000 Received: from hidden.local (hidden.remote[127.0.0.1]) (Authenticated sender: hidden.user) by hvs.heinz-it.de (Postfix) with ESMTPSA id 19FB33E7B7 for ; Fri, 22 Sep 2023 21:42:49 +0200 (CEST) Message-ID: <26608b2d-e4a7-41c3-a6f9-9120a140d3a3@heinz-it.de> Date: Fri, 22 Sep 2023 21:42:48 +0200 MIME-Version: 1.0 Subject: Re: Start service Content-Language: de-DE, ru, en-US To: pgsql-general@lists.postgresql.org References: From: postgresql439848@heinz-it.de In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Am 22.09.23 um 20:40 schrieb Brad White: > I'm trying to start a v15 service on a Windows 2012 R2 server where it > hasn't been used for a while. > The service is set to run as pgUser. > pgUser owns the Postgres directory, including the data dir. > > The command the service is using is > ' "C:\Program Files\PostgreSQL\15\bin\pg_ctl.exe" runservice -N > "postgresql-x64-15" -D "C:\Program Files\PostgreSQL\15\data" -w' > > First off, it's interesting that "runservice" isn't listed as an option for > pg_ctl. > > Windows Event Viewer shows it starting up, handing off logging to pg_log, > then timing out. > Waiting for server startup... > 2023-09-22 12:31:15.173 CDT [5000] LOG: redirecting log output to > logging collector process > 2023-09-22 12:31:15.173 CDT [5000] HINT: Future log output will > appear in directory "pg_log". > Timed out waiting for server startup > > It does create a log file in pg_log, but it is empty. > > If I sub 'start' for 'runservice' and try to start it from CLI, I get > C:\Users\administrator>"C:\Program Files\PostgreSQL\15\bin\pg_ctl.exe" > start > -N "postgresql-x64-15" -D "C:\Program Files\PostgreSQL\15\data" -w > waiting for server to start....2023-09-22 12:48:05.438 CDT [4796] > FATAL: could > not create lock file "postmaster.pid": Permission denied > stopped waiting > pg_ctl: could not start server > Examine the log output. > > And again, I get an empty log file in pg_log. > Is there somewhere else I should check? > > I get the same results if I pass username and password with -U and -P > > I'm running as administrator, so not sure how I get permission denied > Checking EffectiveAccess shows that admin and pgUser have full control, so > I assume this message is a red herring, standing in for the real issue. > > Without an actual error message to fix, I'm not sure how to proceed. > > Thanks, > Brad. > if you want to run postgresql server then you could use "pg_ctl start ..." but to run it as a windows service you first need to register it as a service. so look at pg_ctl register in the options.