Re: PostgreSQL 7.3.2 running as NT service under Windows XP - Mailing list pgsql-cygwin

From Sean McCune
Subject Re: PostgreSQL 7.3.2 running as NT service under Windows XP
Date
Msg-id APEGKLKGNOGPENHOLBEKEEBGDAAA.sean@redhandsoftware.com
Whole thread Raw
In response to Re: PostgreSQL 7.3.2 running as NT service under Windows XP  (Frank Seesink <frank@mail.wvnet.edu>)
List pgsql-cygwin
Sorry, I haven't been religiously reading this list in the last 2 weeks
or I would've replied sooner.

I have written a service for XP in perl (using ActiveState's not
cygwin's perl).  In this service, perl uses Win32::Process::Create() to
run pg_ctl via bash.  This works great.  At service startup, pg_ctl
starts up the database.  There is a small hitch here in that pg_ctl
returns before postgres is actually "ready", so the service currently
waits for an amount of time that seems to guarantee startup.  However, I
plan on changing it to try and establish a connection to the database
before informing Windows that the service is successfully "started", or
failing if it can't ever establish a connection after some reasonable
time.

For shutdown, the service runs pg_ctl again, and waits for the
pg_ctl/bash process to exit before returning.  The database really is
shutdown before pg_ctl returns.  For good measure, I then delete any
cygipc memory mapped files, the pid file, and any lock files that should
not still be hanging around anyway.

The main service loop of this service doesn't do anything but sleep.
But I plan on using it in a particular project to periodically call some
stored procs to drive some functionality that has no other place to
occur.

This service runs in the postgres user context and seems to be operating
fine in testing so far.  Once I get it cleaned up, and make it a little
more generalized, I'll make it available if there's any interest.

Of course, it requires ActiveState perl and a couple of extra modules
such Win32::Daemon from roth.net.  I don't know if it would work under
cygwin's perl or not.

Later,
McC



pgsql-cygwin by date:

Previous
From: Frank Seesink
Date:
Subject: Re: PostgreSQL 7.3.2 running as NT service under Windows XP
Next
From: Jason Tishler
Date:
Subject: Re: PostgreSQL 7.3.2 running as NT service under Windows XP