I can successfully run PG as a service in Windows XP with no problems, but not in Windows Server 2008 or Windows 8, even though the same procedure is being used. This is what I get with Windows XP, which is expected:
C:\>pg_ctl register -N postgres -U btjanes -P XXX -D c:\bin\rtda\pgdata -S auto
C:\>sc query postgres
SERVICE_NAME: postgres
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 1077 (0x435)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\>sc start postgres
SERVICE_NAME: postgres
TYPE : 10 WIN32_OWN_PROCESS
STATE : 2 START_PENDING
(NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x7d0
PID : 1064
FLAGS :
C:\>sc query postgres
SERVICE_NAME: postgres
TYPE : 10 WIN32_OWN_PROCESS
STATE : 4 RUNNING
(STOPPABLE,PAUSABLE,ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
And this is what I get on both Windows Server 2008 and Windows 8:
C:\>pg_ctl register -N postgres -U btjanes -P XXX -D c:\bin\rtda\pgdata -S auto
C:\>sc query postgres
SERVICE_NAME: postgres
TYPE : 10 WIN32_OWN_PROCESS
STATE : 1 STOPPED
WIN32_EXIT_CODE : 1077 (0x435)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\>sc start postgres
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.
In both cases, the same local user account (btjanes) is used. This user is the same one that created the pgdata directory, so there isn't a permissions issue on the directory (I did verify it anyway to be sure). In both cases, PG starts up fine in the command prompt manually using pg_ctl. This issue is killing me and any pointers would be greatly appreciated.
Brian Janes
Technical Product Manager
Runtime Design Automation
Phone: (408) 320-RTDA (7832)
E-mail: brian.janes@xxxxxxxx
Web: www.rtda.com
Technical Product Manager
Runtime Design Automation
Phone: (408) 320-RTDA (7832)
E-mail: brian.janes@xxxxxxxx
Web: www.rtda.com