This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Problem with stopping postmaster with pg_ctl


John,

This turned out to be a problem with /bin/kill.exe in Cygwin 1.5.4, which
should be fixed in the next release
(<http://cygwin.com/ml/cygwin/2003-09/msg01101.html>).  If you're
adventurous, try the snapshot.  Otherwise, a couple of quick workarounds
until /bin/kill is fixed are to use different syntax or use bash's builtin
kill.  For the former, change "kill -15 $PID" to "kill -s 15 $PID".  For
the latter, either change the #! line in pg_ctl to "#!/bin/bash" instead
of "#!/bin/sh", or force bash's kill by using 'bash -c "kill -15 $PID"'
instead of "kill -15 $PID".

Both of these will become unnecessary in the next Cygwin release, but
won't hurt, and should keep you running until then.  Hope this helps,
	Igor

On Wed, 17 Sep 2003, John Pagakis wrote:

> Oh, I meant /bin/kill not /etc/kill on that last post .....
>
> The way Postgres controls things is, when it starts up, it stores the PID it
> started under in a file called postgresql.pid in the data directory.  When
> you use "pg_ctl stop", it reads the pid file and the issues a kill -15 on
> that pid.  It then sits and waits for postgresql.pid to disappear.  After
> one minute, if the file is still there, the script gives up and announces
> that the postmaster will not stop.
>
> If you try this, you'll notice that when you get to the kill in the script,
> you'll get the Usage info on screen.  There is nothing wrong with how pg_ctl
> is formatting the kill.  If you echo out that command and execute it from
> the command line, it works just fine.
>
> I believe the problem is Cygwin's implementation of kill.  From the command
> line if you say kill -sig pid, it works.  If you say /bin/kill -sig pid it
> gives you Usage.  There is something about when you give the fully qualified
> path that it finds offensive.  The script does not give the fully qualified
> path, but based on the behavior, I'm guessing the interpreter resolves to
> the fully qualified path before executing.
>
> Anyway, BEFORE you exit, do this:
>
> 1) ps
> This gives you a list of active processes.
>
> 2) Find the pid for postgres who's ppid is 1.
>
> 3) kill -15 that pid.
>
> 4) Wait for the message that the database is shut down.
>
> Now you can exit.
>
> __________________________________________________________________
> John Pagakis
> Email: john@pagakis.com
>
> "With all your science can you tell how it is, and whence it is, that
>  light comes into the soul?"
>         -- Henry David Thoreau
>
> This signature generated by
>      ... and I Quote!!(tm) Copyright (c) 1999 SpaZmodic Frog Software, Inc.
>                                               www.spazmodicfrog.com
>
>
> -----Original Message-----
> From: Igor Pechtchanski [mailto:pechtcha@cs.nyu.edu]
> Sent: Tuesday, September 16, 2003 1:47 PM
> To: John Pagakis
> Cc: pgsql-cygwin@postgresql.org; cygwin@cygwin.com
> Subject: Re: Problem with stopping postmaster with pg_ctl
>
>
> On Tue, 16 Sep 2003, John Pagakis wrote:
>
> > I'm trying to get Postgres working under Cygwin.  The good news is, it
> > mostly is.  The bad news is, I can't shut it down with pg_ctl.
> >
> > I loaded the full Cygwin installation on my Win2K Pro machine, and later
> on
> > my XP Pro box.  Both behave the same way.
> >
> > When I run pg_ctl stop, it motors for the duration of the wait period and
> > then says the postmaster does not shut down.
> >
> > Upon further review ......
> >
> > It looks like pg_ctl looks through the process list for the Postgres
> process
> > and then tries to kill it.  You can specify the shutdown as smart (which
> > translates to kill -TERM), fast (kill -INT) or immediate (kill -QUIT).
> >
> > When the script hits the kill, I get Usage info on the screen!!  So, the
> > interpreter is not seeing this as a valid command line string for kill.  I
> > have echoed the command being generated out and it looks fine.  I can take
> > that same command and execute it: it shuts Postgres down.
> >
> > Why would the interpreter rejecting the command line for kill when it
> > appears to be well formed?
> >
> > Any help would be greatly appreciated.
>
> You probably have another "kill" in the path before "/bin/kill".  Try
> "bash -c 'exec -l sh'", and from there "which kill".
>
> Had you attached the output of "cygcheck -svr", as requested in the
> problem reporting guidelines at <http://cygwin.com/problems.html>, it
> would have provided some information for a more intelligent guess.
>         Igor

-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]