Frank,
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/postmaster.sh?
> >
> > #!/bin/sh
> > rm -f /usr/share/postgresql/data/postmaster.pid
> > /usr/bin/postmaster $*
> >
> > And then install postmaster.sh as the "service".
>
> Uh...I think this would fall under the category of "BAD Idea",
> wouldn't it? I mean, the whole point of postmaster.pid 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 ]
then
exit 1
fi
...
> > 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...
Jason
--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6