Skip site navigation (1) Skip section navigation (2)

Re: PostgreSQL 7.3.2 running as NT service under Windows XP

From: Jason Tishler <jason(at)tishler(dot)net>
To: Frank Seesink <frank(at)mail(dot)wvnet(dot)edu>
Cc: Pgsql-Cygwin <pgsql-cygwin(at)postgresql(dot)org>
Subject: Re: PostgreSQL 7.3.2 running as NT service under Windows XP
Date: 2003-05-28 16:21:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-cygwin

Sorry for the sluggish response time...

On Sat, May 24, 2003 at 12:07:10AM +0200, Frank Seesink wrote:
> Jason Tishler wrote:
> > Most likely yes.

> Now the big $64K question:  Why? :-)

Looking at the following Cygwin DLL code:

    static BOOL WINAPI
    ctrl_c_handler (DWORD type)
      if (type == CTRL_LOGOFF_EVENT)
        return TRUE;

      /* Return FALSE to prevent an "End task" dialog box from appearing
         for each Cygwin process window that's open when the computer
         is shut down or console window is closed. */
  ***>if (type == CTRL_SHUTDOWN_EVENT)
  ***>  {
  ***>    sig_send (NULL, SIGTERM);
  ***>    return FALSE;
  ***>  }
      if (type == CTRL_CLOSE_EVENT)
          sig_send (NULL, SIGHUP);
          return FALSE;

I'm concerned that the Cygwin DLL is actually sending a SIGTERM to the
postmaster even though cygrunsrv is going to send a SIGINT too.  Does
the postmaster log indicate a "smart shutdown" or "fast shutdown" when
the pid file is not deleted?

> > Why not wrap postmaster in a shell script,
> > /usr/local/bin/
> >
> >     #!/bin/sh
> >     rm -f /usr/share/postgresql/data/
> >     /usr/bin/postmaster $*
> >
> > And then install as the "service".
> Uh...I think this would fall under the category of "BAD Idea",
> wouldn't it?  I mean, the whole point of is to prevent
> MULTIPLE copies of postmaster from firing up against the same data
> set.  All I want to do is make sure no such file exists on startup,
> and ONLY on startup.  The above defeats the purpose by deleting it
> regardless.

I would call the above "quick and dirty".  I wasn't clear but I assumed
the following:

    1. It would only be invoked via net start which will prevent
       multiple instances.
    2. The script was a starting point *not* the the final version.
       One could add something like the following check:

        pg_ctl -D /usr/share/postgresql/data status
        if [ $? -eq 0 ]
            exit 1

> > I can only recommend checking the log file.  Even without the
> > timestamps, you should be able to figure out if PostgreSQL shut and
> > started up cleanly.  You can always start with a fresh log file to
> > facilitate the analysis.
> I've done that.  Still not much use.  PostgreSQL isn't very verbose in
> its logging.

Did you add "-d 5" to the postmaster options?  Maybe this will give you
a better idea of how far postmaster is getting in its shutdown process.
Another option is the hack postmaster to log with timestamps...


PGP/GPG Key: or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6


pgsql-cygwin by date

Next:From: Frank SeesinkDate: 2003-05-28 22:26:59
Subject: Re: PostgreSQL 7.3.2 running as NT service under Windows XP
Previous:From: S. L.Date: 2003-05-28 06:24:20
Subject: Re: PostgreSQL 7.3.2 running as NT service under Windows XP not always

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group