Start service - Mailing list pgsql-general

From Brad White
Subject Start service
Date
Msg-id CAA_1=90EYr-S04dYohGc9gN_WzLSUkaZtcvW4r_1mDJx08YK7A@mail.gmail.com
Whole thread Raw
Responses Re: Start service
Re: Start service
List pgsql-general
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.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: How to fork pg_dump or psql w/o leaking secrets?
Next
From: Nick Ivanov
Date:
Subject: Re: Start service