Re: PostgreSQL 7.3.2 running as NT service under Windows XP

From: "Sean McCune" <sean(at)redhandsoftware(dot)com>
To: <pgsql-cygwin(at)postgresql(dot)org>
Subject: Re: PostgreSQL 7.3.2 running as NT service under Windows XP
Date: 2003-05-30 16:38:05
Message-ID: APEGKLKGNOGPENHOLBEKEEBGDAAA.sean@redhandsoftware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-cygwin by date

  From Date Subject
Next Message Jason Tishler 2003-05-30 21:22:21 Re: PostgreSQL 7.3.2 running as NT service under Windows XP
Previous Message Frank Seesink 2003-05-29 18:26:03 Re: PostgreSQL 7.3.2 running as NT service under Windows XP