public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Problem with stopping postmaster with pg_ctl
@ 2003-09-16 20:18 John Pagakis
  2003-09-16 20:53 ` Igor Pechtchanski
  0 siblings, 1 reply; 11+ messages in thread
From: John Pagakis @ 2003-09-16 20:18 UTC (permalink / raw)
  To: pgsql-cygwin, cygwin

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.

__________________________________________________________________
John Pagakis
Email: john@pagakis.com

"Ideas are more powerful than guns.  We would
 not let our enemies have guns, why should we
 let them have ideas?"
        -- Josef Stalin

This signature generated by
     ... and I Quote!!(tm) Copyright (c) 1999 SpaZmodic Frog Software, Inc.
                                              www.spazmodicfrog.com


--
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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem with stopping postmaster with pg_ctl
  2003-09-16 20:18 Problem with stopping postmaster with pg_ctl John Pagakis
@ 2003-09-16 20:53 ` Igor Pechtchanski
  2003-09-16 21:12   ` John Pagakis
                     ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Igor Pechtchanski @ 2003-09-16 20:53 UTC (permalink / raw)
  To: John Pagakis; +Cc: pgsql-cygwin, cygwin

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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Problem with stopping postmaster with pg_ctl
  2003-09-16 20:53 ` Igor Pechtchanski
@ 2003-09-16 21:12   ` John Pagakis
  2003-09-16 21:53   ` John Pagakis
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: John Pagakis @ 2003-09-16 21:12 UTC (permalink / raw)
  To: cygwin

Thanks Igor.  I'll try that.

In the mean time:


Cygwin Win95/NT Configuration Diagnostics
Current System Time: Tue Sep 16 14:04:06 2003

Windows 2000 Professional Ver 5.0 Build 2195 Service Pack 3

Path:	C:\cygwin\usr\local\bin
	C:\cygwin\bin
	C:\cygwin\bin
	C:\cygwin\usr\X11R6\bin
	c:\WINNT\system32
	c:\WINNT
	c:\WINNT\System32\Wbem
	c:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT
	c:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin
	c:\Program Files\Microsoft Visual Studio\Common\Tools
	c:\Program Files\Microsoft Visual Studio\VC98\bin
	C:\cygwin\usr\local\pgsql\bin
	C:\cygwin\usr\local\bin

Output from C:\cygwin\bin\id.exe (nontsec)
UID: 11108(xx) GID: 10513(mkgroup-l-d)
10513(mkgroup-l-d)

Output from C:\cygwin\bin\id.exe (ntsec)
UID: 11108(xx) GID: 10513(mkgroup-l-d)
544(Administrators)   545(Users)
1003(Debugger Users)  10513(mkgroup-l-d)

SysDir: C:\WINNT\System32
WinDir: C:\WINNT

HOME = `c:\'
LD_LIBRARY_PATH = `C:\cygwin\usr\local\pgsql\lib:\usr\local\lib'
MAKE_MODE = `unix'
PWD = `/cygdrive/c'
USER = `xx'

ALLUSERSPROFILE = `C:\Documents and Settings\All Users'
APPDATA = `C:\Documents and Settings\xx\Application Data'
COMMONPROGRAMFILES = `C:\Program Files\Common Files'
COMPUTERNAME = `NoneOfYourBusiness'
COMSPEC = `C:\WINNT\system32\cmd.exe'
CVS_RSH = `/bin/ssh'
HOMEDRIVE = `C:'
HOMEPATH = `\'
HOSTNAME = `NoneOfYourBusiness'
INCLUDE = `C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\include\;C:\Program Files\Microsoft Visual
Studio\VC98\atl\include;C:\Program Files\Microsoft Visual
Studio\VC98\mfc\include;C:\Program Files\Microsoft Visual
Studio\VC98\include'
INFOPATH =
`/usr/local/info:/usr/info:/usr/share/info:/usr/autotool/devel/info:/usr/aut
otool/stable/info:'
LIB = `C:\Program Files\Microsoft Visual Studio
.NET\FrameworkSDK\Lib\;C:\Program Files\Microsoft Visual
Studio\VC98\mfc\lib;C:\Program Files\Microsoft Visual Studio\VC98\lib'
LOGONSERVER = `\\NoneOfYourBusiness'
MANPATH =
`/usr/local/man:/usr/man:/usr/share/man:/usr/autotool/devel/man::/usr/ssl/ma
n'
MSDEVDIR = `C:\Program Files\Microsoft Visual Studio\Common\MSDev98'
NUMBER_OF_PROCESSORS = `1'
OLDPWD = `/usr/bin'
OS2LIBPATH = `C:\WINNT\system32\os2\dll;'
OS = `Windows_NT'
PATHEXT = `.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
PGDATA = `/usr/share/postgresql/data'
PGLIB = `/usr/local/pgsql/lib'
PROCESSOR_ARCHITECTURE = `x86'
PROCESSOR_IDENTIFIER = `x86 Family 6 Model 6 Stepping 2, AuthenticAMD'
PROCESSOR_LEVEL = `6'
PROCESSOR_REVISION = `0602'
PROGRAMFILES = `C:\Program Files'
PROMPT = `$P$G'
PS1 = `\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
SHLVL = `1'
SYSTEMDRIVE = `C:'
SYSTEMROOT = `C:\WINNT'
TEMP = `c:\DOCUME~1\xx\LOCALS~1\Temp'
TERM = `cygwin'
TEXMF = `{/usr/share/lilypond/1.8.1,/usr/share/texmf}'
TMP = `c:\DOCUME~1\xx\LOCALS~1\Temp'
USERDNSDOMAIN = `NoneOfYourBusiness.xxxx1.NoneOfYourBusiness.COM'
USERDOMAIN = `NoneOfYourBusiness'
USERNAME = `xx'
USERPROFILE = `C:\Documents and Settings\xx'
VSCOMNTOOLS = `"C:\Program Files\Microsoft Visual Studio
.NET\Common7\Tools\"'
WINDIR = `C:\WINNT'
_ = `/usr/bin/cygcheck'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x00000022
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `C:\cygwin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `C:\cygwin/bin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `C:\cygwin/lib'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts
v2\/usr/X11R6/lib/X11/fonts
  (default) = `C:\cygwin\usr\X11R6\lib\X11\fonts'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\Program Options

a:  fd           N/A    N/A
c:  hd  NTFS   38154Mb  28% CP CS UN PA FC
d:  hd  NTFS   39079Mb  88% CP CS UN PA FC
e:  fd           N/A    N/A
f:  cd           N/A    N/A

C:\cygwin                          /                         system  binmode
C:\cygwin/bin                      /usr/bin                  system  binmode
C:\cygwin/lib                      /usr/lib                  system  binmode
C:\cygwin\usr\X11R6\lib\X11\fonts  /usr/X11R6/lib/X11/fonts  system  binmode
.                                  /cygdrive                 system
binmode,cygdrive

Found: C:\cygwin\bin\awk.exe
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: C:\cygwin\bin\cp.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\grep.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\mv.exe
Found: C:\cygwin\bin\rm.exe
Found: C:\cygwin\bin\sed.exe
Found: C:\cygwin\bin\sh.exe
Found: C:\cygwin\bin\tar.exe

   61k 2003/08/09 C:\cygwin\bin\cygbz2-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz2-1.dll" v0.0 ts=2003/8/8 23:35
   54k 2002/01/27 C:\cygwin\bin\cygbz21.0.dll - os=4.0 img=1.0 sys=4.0
                  "cygbz21.0.dll" v0.0 ts=2002/1/26 18:07
   14k 2003/08/10 C:\cygwin\bin\cygcharset-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygcharset-1.dll" v0.0 ts=2003/8/10 13:57
  849k 2003/08/11 C:\cygwin\bin\cygcrypto-0.9.7.dll - os=4.0 img=1.0 sys=4.0
                  "cygcrypto-0.9.7.dll" v0.0 ts=2003/8/11 1:58
  645k 2003/04/11 C:\cygwin\bin\cygcrypto.dll - os=4.0 img=1.0 sys=4.0
                  "cygcrypto.dll" v0.0 ts=2003/4/11 3:37
  551k 2003/04/02 C:\cygwin\bin\cygcurl-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygcurl-2.dll" v0.0 ts=2003/4/2 14:09
   28k 2003/08/11 C:\cygwin\bin\cygcygipc-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygcygipc-2.dll" v0.0 ts=2003/8/10 17:54
  380k 2002/07/24 C:\cygwin\bin\cygdb-3.1.dll - os=4.0 img=1.0 sys=4.0
                  "cygdb-3.1.dll" v0.0 ts=2002/7/24 9:24
  326k 2002/06/26 C:\cygwin\bin\cygdb2.dll - os=4.0 img=1.0 sys=4.0
                  "cygdb2.dll" v0.0 ts=2002/6/26 10:48
  487k 2002/07/24 C:\cygwin\bin\cygdb_cxx-3.1.dll - os=4.0 img=1.0 sys=4.0
                  "cygdb_cxx-3.1.dll" v0.0 ts=2002/7/24 9:25
  135k 2003/04/13 C:\cygwin\bin\cygexpat-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygexpat-0.dll" v0.0 ts=2003/4/13 14:24
   61k 2003/06/10 C:\cygwin\bin\cygexslt-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygexslt-0.dll" v0.0 ts=2003/6/10 11:07
   45k 2001/04/25 C:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/4/24 22:28
   35k 2002/01/09 C:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
                  "cygform6.dll" v0.0 ts=2002/1/8 23:03
   48k 2003/08/09 C:\cygwin\bin\cygform7.dll - os=4.0 img=1.0 sys=4.0
                  "cygform7.dll" v0.0 ts=2003/8/9 2:25
   28k 2003/07/20 C:\cygwin\bin\cyggdbm-3.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm-3.dll" v0.0 ts=2003/7/20 0:58
   30k 2003/08/11 C:\cygwin\bin\cyggdbm-4.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm-4.dll" v0.0 ts=2003/8/10 19:12
   19k 2003/03/22 C:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2002/2/19 20:05
   15k 2003/07/20 C:\cygwin\bin\cyggdbm_compat-3.dll - os=4.0 img=1.0
sys=4.0
                  "cyggdbm_compat-3.dll" v0.0 ts=2003/7/20 1:00
   15k 2003/08/11 C:\cygwin\bin\cyggdbm_compat-4.dll - os=4.0 img=1.0
sys=4.0
                  "cyggdbm_compat-4.dll" v0.0 ts=2003/8/10 19:13
   69k 2003/08/10 C:\cygwin\bin\cyggettextlib-0-12-1.dll - os=4.0 img=1.0
sys=4.0
                  "cyggettextlib-0-12-1.dll" v0.0 ts=2003/8/10 15:10
   12k 2003/08/10 C:\cygwin\bin\cyggettextpo-0.dll - os=4.0 img=1.0 sys=4.0
                  "cyggettextpo-0.dll" v0.0 ts=2003/8/10 15:11
  134k 2003/08/10 C:\cygwin\bin\cyggettextsrc-0-12-1.dll - os=4.0 img=1.0
sys=4.0
                  "cyggettextsrc-0-12-1.dll" v0.0 ts=2003/8/10 15:10
  489k 2003/08/09 C:\cygwin\bin\cygguile-12.dll - os=4.0 img=1.0 sys=4.0
                  "cygguile-12.dll" v0.0 ts=2003/8/9 7:17
  489k 2003/07/28 C:\cygwin\bin\cygguile-12abi13.dll - os=4.0 img=1.0
sys=4.0
                  "cygguile-12abi13.dll" v0.0 ts=2003/7/28 11:18
   24k 2003/08/09 C:\cygwin\bin\cygguile-ltdl-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygguile-ltdl-1.dll" v0.0 ts=2003/8/9 7:16
   24k 2003/07/28 C:\cygwin\bin\cygguile-ltdl-1abi13.dll - os=4.0 img=1.0
sys=4.0
                  "cygguile-ltdl-1abi13.dll" v0.0 ts=2003/7/28 10:48
   62k 2003/08/09 C:\cygwin\bin\cygguile-srfi-srfi-13-14-v-1-1.dll - os=4.0
img=1.0 sys=4.0
                  "cygguile-srfi-srfi-13-14-v-1-1.dll" v0.0 ts=2003/8/9 7:17
   62k 2003/07/28 C:\cygwin\bin\cygguile-srfi-srfi-13-14-v-1-1abi13.dll -
os=4.0 img=1.0 sys=4.0
                  "cygguile-srfi-srfi-13-14-v-1-1abi13.dll" v0.0
ts=2003/7/28 11:18
   23k 2003/08/09 C:\cygwin\bin\cygguile-srfi-srfi-4-v-1-1.dll - os=4.0
img=1.0 sys=4.0
                  "cygguile-srfi-srfi-4-v-1-1.dll" v0.0 ts=2003/8/9 7:17
   23k 2003/07/28 C:\cygwin\bin\cygguile-srfi-srfi-4-v-1-1abi13.dll - os=4.0
img=1.0 sys=4.0
                  "cygguile-srfi-srfi-4-v-1-1abi13.dll" v0.0 ts=2003/7/28
11:18
   11k 2003/08/09 C:\cygwin\bin\cygguilereadline-v-12-12.dll - os=4.0
img=1.0 sys=4.0
                  "cygguilereadline-v-12-12.dll" v0.0 ts=2003/8/9 7:17
   11k 2003/07/28 C:\cygwin\bin\cygguilereadline-v-12-12abi13.dll - os=4.0
img=1.0 sys=4.0
                  "cygguilereadline-v-12-12abi13.dll" v0.0 ts=2003/7/28
11:18
   17k 2001/06/28 C:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/6 21:34
   29k 2003/08/10 C:\cygwin\bin\cyghistory5.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory5.dll" v0.0 ts=2003/8/10 16:16
  306k 2002/04/27 C:\cygwin\bin\cyghttpd.dll - os=4.0 img=1.0 sys=4.0
                  "cyghttpd.dll" v0.0 ts=2002/4/27 6:23
  958k 2003/08/10 C:\cygwin\bin\cygiconv-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygiconv-2.dll" v0.0 ts=2003/8/10 13:57
   22k 2001/12/13 C:\cygwin\bin\cygintl-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-1.dll" v0.0 ts=2001/12/13 2:28
   37k 2003/08/10 C:\cygwin\bin\cygintl-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-2.dll" v0.0 ts=2003/8/10 14:50
   21k 2001/06/20 C:\cygwin\bin\cygintl.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl.dll" v0.0 ts=2001/6/20 10:09
   12k 2003/02/17 C:\cygwin\bin\cygioperm-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygioperm-0.dll" v0.0 ts=2003/2/17 12:58
   48k 2003/08/10 C:\cygwin\bin\cygjbig1.dll - os=4.0 img=1.0 sys=4.0
                  "cygjbig1.dll" v0.0 ts=2003/8/10 16:58
  132k 2003/08/11 C:\cygwin\bin\cygjpeg-62.dll - os=4.0 img=1.0 sys=4.0
                  "cygjpeg-62.dll" v0.0 ts=2003/8/10 17:37
  119k 2002/02/09 C:\cygwin\bin\cygjpeg6b.dll - os=4.0 img=1.0 sys=4.0
                  "cygjpeg6b.dll" v0.0 ts=2002/2/8 22:19
   61k 2003/08/09 C:\cygwin\bin\cygkpathsea-3.dll - os=4.0 img=1.0 sys=4.0
                  "cygkpathsea-3.dll" v0.0 ts=2003/8/9 7:52
   60k 2003/07/27 C:\cygwin\bin\cygkpathsea-3abi13.dll - os=4.0 img=1.0
sys=4.0
                  "cygkpathsea-3abi13.dll" v0.0 ts=2003/7/27 13:23
   32k 2003/08/18 C:\cygwin\bin\cygltdl-3.dll - os=4.0 img=1.0 sys=4.0
                  "cygltdl-3.dll" v0.0 ts=2003/8/17 22:35
   26k 2001/04/25 C:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/4/24 22:27
   20k 2002/01/09 C:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu6.dll" v0.0 ts=2002/1/8 23:03
   29k 2003/08/09 C:\cygwin\bin\cygmenu7.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu7.dll" v0.0 ts=2003/8/9 2:25
  453k 2003/07/27 C:\cygwin\bin\cygnaim_core-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygnaim_core-0.dll" v0.0 ts=2003/7/26 22:46
  156k 2001/04/25 C:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/4/24 22:29
  175k 2002/01/09 C:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++6.dll" v0.0 ts=2002/1/8 23:03
  226k 2001/04/25 C:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/4/24 22:17
  202k 2002/01/09 C:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses6.dll" v0.0 ts=2002/1/8 23:03
  224k 2003/08/09 C:\cygwin\bin\cygncurses7.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses7.dll" v0.0 ts=2003/8/9 2:24
   15k 2001/04/25 C:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/4/24 22:27
   12k 2002/01/09 C:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel6.dll" v0.0 ts=2002/1/8 23:03
   19k 2003/08/09 C:\cygwin\bin\cygpanel7.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel7.dll" v0.0 ts=2003/8/9 2:24
   67k 2003/09/10 C:\cygwin\bin\cygpcre-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcre-0.dll" v0.0 ts=2003/9/10 7:25
   63k 2003/04/11 C:\cygwin\bin\cygpcre.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcre.dll" v0.0 ts=2003/4/11 1:31
   15k 2003/09/10 C:\cygwin\bin\cygpcreposix-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcreposix-0.dll" v0.0 ts=2003/9/10 7:25
   61k 2003/04/11 C:\cygwin\bin\cygpcreposix.dll - os=4.0 img=1.0 sys=4.0
                  "cygpcreposix.dll" v0.0 ts=2003/4/11 1:31
 1100k 2003/08/29 C:\cygwin\bin\cygperl5_8_0.dll - os=4.0 img=1.0 sys=4.0
                  "cygperl5_8_0.dll" v0.0 ts=2003/8/29 3:20
  168k 2003/08/10 C:\cygwin\bin\cygpng10.dll - os=4.0 img=1.0 sys=4.0
                  "cygpng10.dll" v0.0 ts=2003/8/10 15:31
  173k 2003/08/10 C:\cygwin\bin\cygpng12.dll - os=4.0 img=1.0 sys=4.0
                  "cygpng12.dll" v0.0 ts=2003/8/10 15:35
  170k 2002/01/21 C:\cygwin\bin\cygpng2.dll - os=4.0 img=1.0 sys=4.0
                  "cygpng2.dll" v0.0 ts=2002/1/20 18:05
   22k 2002/06/09 C:\cygwin\bin\cygpopt-0.dll - os=4.0 img=1.0 sys=4.0
                  "cygpopt-0.dll" v0.0 ts=2002/6/8 22:45
  108k 2001/06/28 C:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline4.dll" v0.0 ts=2001/1/6 21:34
  148k 2003/08/10 C:\cygwin\bin\cygreadline5.dll - os=4.0 img=1.0 sys=4.0
                  "cygreadline5.dll" v0.0 ts=2003/8/10 16:16
  689k 2003/08/11 C:\cygwin\bin\cygruby18.dll - os=4.0 img=1.0 sys=4.0
                  "cygruby18.dll" v0.0 ts=2003/8/11 6:27
  176k 2003/08/11 C:\cygwin\bin\cygssl-0.9.7.dll - os=4.0 img=1.0 sys=4.0
                  "cygssl-0.9.7.dll" v0.0 ts=2003/8/11 1:58
  165k 2003/04/11 C:\cygwin\bin\cygssl.dll - os=4.0 img=1.0 sys=4.0
                  "cygssl.dll" v0.0 ts=2003/4/11 3:37
  281k 2003/02/24 C:\cygwin\bin\cygtiff3.dll - os=4.0 img=1.0 sys=4.0
                  "cygtiff3.dll" v0.0 ts=2003/2/23 21:58
  282k 2003/08/11 C:\cygwin\bin\cygtiff4.dll - os=4.0 img=1.0 sys=4.0
                  "cygtiff4.dll" v0.0 ts=2003/8/10 19:32
   25k 2002/07/14 C:\cygwin\bin\cygungif-4.dll - os=4.0 img=1.0 sys=4.0
                  "cygungif-4.dll" v0.0 ts=2002/7/14 7:58
 2689k 2002/11/16 C:\cygwin\bin\cygxerces-c21.dll - os=4.0 img=1.0 sys=4.0
                  "cygxerces-c21.dll" v0.0 ts=2002/11/15 21:07
 2984k 2003/02/07 C:\cygwin\bin\cygxerces-c22.dll - os=4.0 img=1.0 sys=4.0
                  "cygxerces-c22.dll" v0.0 ts=2003/2/7 11:50
 3088k 2003/06/11 C:\cygwin\bin\cygxerces-c23.dll - os=4.0 img=1.0 sys=4.0
                  "cygxerces-c23.dll" v0.0 ts=2003/6/11 16:40
  903k 2003/06/09 C:\cygwin\bin\cygxml2-2.dll - os=4.0 img=1.0 sys=4.0
                  "cygxml2-2.dll" v0.0 ts=2003/6/9 16:49
   50k 2003/08/09 C:\cygwin\bin\cygXpm-noX4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-noX4.dll" v0.0 ts=2003/8/9 0:21
   54k 2003/08/09 C:\cygwin\bin\cygXpm-X4.dll - os=4.0 img=1.0 sys=4.0
                  "cygXpm-X4.dll" v0.0 ts=2003/8/9 0:22
  174k 2003/06/10 C:\cygwin\bin\cygxslt-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygxslt-1.dll" v0.0 ts=2003/6/10 10:42
   13k 2003/06/10 C:\cygwin\bin\cygxsltbreakpoint-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygxsltbreakpoint-1.dll" v0.0 ts=2003/6/10 11:07
   60k 2003/08/09 C:\cygwin\bin\cygz.dll - os=4.0 img=1.0 sys=4.0
                  "cygz.dll" v0.0 ts=2003/8/8 23:28
  947k 2003/09/13 C:\cygwin\bin\cygwin1.dll - os=4.0 img=1.0 sys=4.0
                  "cygwin1.dll" v0.0 ts=2003/9/12 20:09
    Cygwin DLL version info:
        DLL version: 1.5.4
        DLL epoch: 19
        DLL bad signal mask: 19005
        DLL old termios: 5
        DLL malloc env: 28
        API major: 0
        API minor: 94
        Shared data: 3
        DLL identifier: cygwin1
        Mount registry: 2
        Cygnus registry name: Cygnus Solutions
        Cygwin registry name: Cygwin
        Program options name: Program Options
        Cygwin mount registry name: mounts v2
        Cygdrive flags: cygdrive flags
        Cygdrive prefix: cygdrive prefix
        Cygdrive default prefix:
        Build date: Fri Sep 12 23:08:58 EDT 2003
        Shared id: cygwin1S3

  671k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygdps-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygdps-1.dll" v0.0 ts=2003/7/31 21:06
   53k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygdpstk-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygdpstk-1.dll" v0.0 ts=2003/7/31 21:06
  146k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygexpat-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygexpat-1.dll" v0.0 ts=2003/7/31 21:06
  174k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygfontconfig-1.dll - os=4.0
img=1.0 sys=4.0
                  "cygfontconfig-1.dll" v0.0 ts=2003/7/31 21:06
  340k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygfreetype-9.dll - os=4.0 img=1.0
sys=4.0
                  "cygfreetype-9.dll" v0.0 ts=2003/7/31 21:06
  524k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygGL-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygGL-1.dll" v0.0 ts=2003/7/31 21:05
  592k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygGLU-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygGLU-1.dll" v0.0 ts=2003/7/31 21:05
  109k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygICE-6.dll - os=4.0 img=1.0
sys=4.0
                  "cygICE-6.dll" v0.0 ts=2003/7/31 21:05
   25k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygoldX-6.dll - os=4.0 img=1.0
sys=4.0
                  "cygoldX-6.dll" v0.0 ts=2003/7/31 21:04
 1510k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygOSMesa-4.dll - os=4.0 img=1.0
sys=4.0
                  "cygOSMesa-4.dll" v0.0 ts=2003/7/31 21:05
   41k 2002/05/14 C:\cygwin\usr\X11R6\bin\cygPropList-0.dll - os=4.0 img=1.0
sys=4.0
                  "cygPropList-0.dll" v0.0 ts=2002/5/13 20:13
   40k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygpsres-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygpsres-1.dll" v0.0 ts=2003/7/31 21:06
   54k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygSM-6.dll - os=4.0 img=1.0
sys=4.0
                  "cygSM-6.dll" v0.0 ts=2003/7/31 21:05
 1067k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygX11-6.dll - os=4.0 img=1.0
sys=4.0
                  "cygX11-6.dll" v0.0 ts=2003/7/31 21:04
   57k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXcursor-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygXcursor-1.dll" v0.0 ts=2003/7/31 21:06
   77k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXext-6.dll - os=4.0 img=1.0
sys=4.0
                  "cygXext-6.dll" v0.0 ts=2003/7/31 21:05
   83k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXft-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygXft-1.dll" v0.0 ts=2003/7/31 21:06
  105k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXft-2.dll - os=4.0 img=1.0
sys=4.0
                  "cygXft-2.dll" v0.0 ts=2003/7/31 21:06
   53k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXi-6.dll - os=4.0 img=1.0
sys=4.0
                  "cygXi-6.dll" v0.0 ts=2003/7/31 21:05
   29k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXmuu-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygXmuu-1.dll" v0.0 ts=2003/7/31 21:05
   58k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXp-6.dll - os=4.0 img=1.0
sys=4.0
                  "cygXp-6.dll" v0.0 ts=2003/7/31 21:05
   81k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXpm-4.dll - os=4.0 img=1.0
sys=4.0
                  "cygXpm-4.dll" v0.0 ts=2003/7/31 21:05
   29k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXrandr-2.dll - os=4.0 img=1.0
sys=4.0
                  "cygXrandr-2.dll" v0.0 ts=2003/7/31 21:06
   49k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXrender-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygXrender-1.dll" v0.0 ts=2003/7/31 21:06
  384k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXTrap-6.dll - os=4.0 img=1.0
sys=4.0
                  "cygXTrap-6.dll" v0.0 ts=2003/7/31 21:06
   38k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXtst-6.dll - os=4.0 img=1.0
sys=4.0
                  "cygXtst-6.dll" v0.0 ts=2003/7/31 21:05
   34k 2003/08/01 C:\cygwin\usr\X11R6\bin\cygXv-1.dll - os=4.0 img=1.0
sys=4.0
                  "cygXv-1.dll" v0.0 ts=2003/7/31 21:05

Cygwin Package Information
Last downloaded files to: C:\Dnld\Cygwin
Last downloaded files from: ftp://cygwin.mirrors.pair.com

Package                 Version
_update-info-dir        00214-1
a2ps                    4.13-1
agetty                  2.1-1
apache                  1.3.24-5
ash                     20020731-3
astyle                  1.15.3-3
autoconf                2.57a-1
autoconf-devel          2.57-2
autoconf-stable         2.13-5
automake                1.7.5a-1
automake-devel          1.7.6-2
automake-stable         1.4p5-6
base-files              2.5-1
base-passwd             1.1-1
bash                    2.05b-15
bc                      1.06-1
binutils                20030901-1
bison                   20030307-1
byacc                   1.9-1
bzip2                   1.0.2-5
c-client                2002e-1
ccache                  2.2-1
ccdoc                   0.8.39-1
cgoban                  1.9.14-1
chkconfig               1.2.24h-1
clear                   1.0-1
cmake                   1.6.7-1
compface                1.4-5
cpio                    2.5-3
cron                    3.0.1-11
crypt                   1.0-2
ctags                   5.5-4
curl                    7.10.4-1
curl-devel              7.10.4-1
cvs                     1.11.6-3
cygipc                  2.01-2
cygrunsrv               0.96-2
cygutils                1.2.1-2
cygwin                  1.5.4-1
cygwin-doc              1.3-6
db2                     2.7.7-4
db3.1                   3.1.17-2
dejagnu                 20021217-2
diffutils               2.8.4-1
docbook-xml42           4.2-1
docbook-xsl             1.62.0-1
doxygen                 1.2.18-1
dpkg                    1.10.4-2
ed                      0.2-1
ELFIO                   1.0.0-1
emacs                   21.2-12
emacs-el                21.2-12
emacs-X11               21.2-12
enscript                1.6.3-3
exim                    4.22-1
expat                   1.95.6-1
expect                  20030128-1
fetchmail               6.2.4-1
figlet                  2.2-1
file                    4.03-2
fileutils               4.1-2
findutils               4.1.7-4
flex                    2.5.31-1
fortune                 1.8-2
fvwm                    2.4.7-2
gawk                    3.1.3-3
gcc                     3.2-3
gcc-mingw               20020817-5
gcc2                    2.95.3-10
gdb                     20030901-1
gdbm                    1.8.3-7
gettext                 0.12.1-3
gettext-devel           0.12.1-3
ghostscript             7.05-2
ghostscript-base        7.05-2
ghostscript-x11         7.05-2
gnugo                   3.4-1
gnupg                   1.2.2-1
gperf                   2.7.2-1
grace                   5.1.12-1
grep                    2.5-1
groff                   1.18.1-2
gsl                     1.4-1
guile                   1.6.4-12
guile-devel             1.6.4-12
guile-doc               1.6.4-12
gzip                    1.3.3-4
indent                  2.2.8-1
inetutils               1.3.2-24
initscripts             0.9-1
ioperm                  0.4-1
irc                     20010101-3
jbigkit                 1.5-3
jgraph                  8.3-1
jpeg                    6b-11
keychain                1.9-1
less                    381-1
lesstif                 0.93.41-1
libbz2_0                1.0.2-1
libbz2_1                1.0.2-5
libcharset1             1.9.1-3
libdb2                  2.7.7-4
libdb2-devel            2.7.7-4
libdb3.1                3.1.17-2
libdb3.1-devel          3.1.17-2
libgdbm                 1.8.0-5
libgdbm-devel           1.8.3-7
libgdbm3                1.8.3-3
libgdbm4                1.8.3-7
libgettextpo0           0.12.1-3
libguile12              1.6.4-12
libguile12abi13         1.6.4-2
libiconv                1.9.1-3
libiconv2               1.9.1-3
libintl                 0.10.38-3
libintl1                0.10.40-1
libintl2                0.12.1-3
libjpeg62               6b-11
libjpeg6b               6b-8
libkpathsea3            2.0.2-12
libkpathsea3abi13       2.0.2-2
libltdl3                1.5-3
libncurses-devel        5.3-4
libncurses5             5.2-1
libncurses6             5.2-8
libncurses7             5.3-4
libpcre                 4.1-1
libpcre0                4.4-2
libpng                  1.2.5-4
libpng10                1.0.15-4
libpng10-devel          1.0.15-4
libpng12                1.2.5-4
libpng12-devel          1.2.5-4
libpng2                 1.0.12-1
libpopt0                1.6.4-4
libPropList             0.10.1-3
libreadline4            4.1-2
libreadline5            4.3-5
libtiff-devel           3.6.0-5
libtiff3                3.6.0-2
libtiff4                3.6.0-5
libtool                 1.5a-1
libtool-devel           1.5-3
libtool-stable          1.4.3-2
libungif                4.1.0-2
libxerces-c21           2.1.0-1
libxerces-c22           2.2.0-1
libxerces-c23           2.3.0-2
libxml2                 2.5.7-1
libxslt                 1.0.30-2
lilypond                1.8.1-12
lilypond-doc            1.8.1-12
links                   0.96-1
login                   1.9-7
lynx                    2.8.4-7
m4                      1.4-1
make                    3.80-1
man                     1.5j-2
mc                      4.6.0-4
mingw-runtime           3.0-1
mingw-zlib              1.1.4-4
mktemp                  1.5-3
mod_auth_mysql          1.11-1
mod_auth_ntsec          1.7-1
mod_dav                 1.0.3-1.3.6-1
mod_php4                4.2.0-2
mod_ssl                 2.8.8-1.3.24-1
more                    2.11o-1
mt                      2.0.1-2
mutt                    1.4-1
naim                    0.11.6-2
nano                    1.2.2-1
nasm                    0.98.37-1
ncftp                   3.1.4-1
ncurses                 5.3-4
ncurses-demo            5.3-4
netcat                  1.10-2
openbox                 0.99.1-3
opengl                  1.1.0-6
openssh                 3.6.1p2-2
openssl                 0.9.7b-3
openssl-devel           0.9.7b-3
openssl096              0.9.6j-1
par                     1.52-1
patch                   2.5.8-8
patchutils              0.2.22-2
pcre                    4.4-2
pcre-devel              4.4-2
pcre-doc                4.4-2
pdksh                   5.2.14-2
perl                    5.8.0-5
perl_manpages           5.8.0-5
pine                    4.55-1
pinfo                   0.6.8-1
pkgconfig               0.15.0-4
popt                    1.6.4-4
postgresql              7.3.4-2
procmail                3.22-8
procps                  010801-2
proftpd                 1.2.9rc1-3
psutils                 1.17-1
python                  2.3-2
rcs                     5.7-3
readline                4.3-5
rebase                  2.2-3
robots                  2.0-3
rpm                     4.1-1
rpm-build               4.1-1
rpm-doc                 4.1-1
rsync                   2.5.6-2
ruby                    1.8.0-1
rxvt                    2.7.10-3
sed                     4.0.7-3
sh-utils                2.0.15-4
sharutils               4.2.1-3
shutdown                1.4-1
splint                  3.1.1-1
squid                   2.4.STABLE7-1
ssmtp                   2.38.7-4
stunnel                 4.04-3
sunrpc                  4.0-1
SWI-Prolog              5.2.6-1
swig                    1.3.19-1
sysvinit                2.84-4
tar                     1.13.25-3
tcltk                   20030901-1
tcp_wrappers            7.6-1
tcsh                    6.12.00-7
termcap                 20021106-2
terminfo                5.3_20030726-1
tetex                   2.0.2-12
tetex-base              2.0.2-12
tetex-bin               2.0.2-12
tetex-devel             2.0.2-12
tetex-doc               2.0.2-12
tetex-extra             2.0.2-12
tetex-tiny              2.0.2-12
tetex-x11               2.0.2-12
texinfo                 4.2-4
textutils               2.0.21-1
tidy                    030201-1
tiff                    3.6.0-5
time                    1.7-1
tin                     1.6.1-1
ttcp                    19980512-1
ucl                     1.01-1
units                   1.77-1
unzip                   5.50-5
upx                     1.24-1
uw-imap                 2002e-1
uw-imap-imapd           2002e-1
uw-imap-util            2002e-1
vim                     6.2-3
w32api                  2.4-1
wget                    1.8.2-2
which                   1.5-2
whois                   4.6.2-1
WindowMaker             0.80.0-2
wtf                     0.0.4-4
x2x                     1.27-2
Xaw3d                   1.5-1
xerces-c                2.3.0-2
xerces-c-devel          2.3.0-2
xerces-c-doc            2.3.0-2
XFree86-base            4.3.0-1
XFree86-bin             4.3.0-2
XFree86-bin-icons       4.3.0-2
XFree86-doc             4.3.0-1
XFree86-etc             4.3.0-3
XFree86-f100            4.2.0-3
XFree86-fcyr            4.2.0-3
XFree86-fenc            4.2.0-3
XFree86-fnts            4.2.0-3
XFree86-fscl            4.2.0-3
XFree86-fsrv            4.3.0-1
XFree86-html            4.3.0-1
XFree86-jdoc            4.3.0-1
XFree86-lib             4.3.0-1
XFree86-lib-compat      4.3.0-1
XFree86-man             4.3.0-1
XFree86-nest            4.3.0-1
XFree86-prog            4.3.0-4
XFree86-prt             4.3.0-1
XFree86-ps              4.3.0-1
XFree86-startup-scripts 4.2.0-5
XFree86-vfb             4.3.0-1
XFree86-xserv           4.3.0-9
XFree86-xwinclip        4.3.0-1
xinetd                  2.3.9-1
xmlto                   0.0.14-1
xpm-nox                 4.2.0-4
zip                     2.3-5
zlib                    1.1.4-4
zsh                     4.0.7-2
Use -h to see help about each section

__________________________________________________________________
John Pagakis
Email: john@pagakis.com

"I knew we were in for a long season when we
 lined up for the National Anthem on opening
 day and one of my players said, 'Every time
 I hear that song I have a bad game.' "
        -- Jim Leyland
           Manager of the Pittsburgh Pirates,
           World Series Champion Florida Marlins
           and the Colorado Rockies (1986-99)

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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Problem with stopping postmaster with pg_ctl
  2003-09-16 20:53 ` Igor Pechtchanski
  2003-09-16 21:12   ` John Pagakis
@ 2003-09-16 21:53   ` John Pagakis
  2003-09-16 22:00     ` Christopher Faylor
  2003-09-17 15:28   ` John Pagakis
  2003-09-17 15:50   ` John Pagakis
  3 siblings, 1 reply; 11+ messages in thread
From: John Pagakis @ 2003-09-16 21:53 UTC (permalink / raw)
  To: cygwin

Igor -
You may be on to something ....

If I say "which kill" at the command line it tells me /usr/bin/kill; if I
echo it out of the script I get the same thing.  If I type
"/usr/bin/kill -15 9999" at the command line I get Usage.  If I type
"kill -15 9999" it works just fine.

__________________________________________________________________
John Pagakis
Email: john@pagakis.com

"If enlightenment is not where you are standing,
 where will you look?"
        -- Zen saying

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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Problem with stopping postmaster with pg_ctl
  2003-09-16 21:53   ` John Pagakis
@ 2003-09-16 22:00     ` Christopher Faylor
  0 siblings, 0 replies; 11+ messages in thread
From: Christopher Faylor @ 2003-09-16 22:00 UTC (permalink / raw)
  To: cygwin

On Tue, Sep 16, 2003 at 02:44:50PM -0700, John Pagakis wrote:
>Igor -
>You may be on to something ....
>
>If I say "which kill" at the command line it tells me /usr/bin/kill; if I
>echo it out of the script I get the same thing.  If I type
>"/usr/bin/kill -15 9999" at the command line I get Usage.  If I type
>"kill -15 9999" it works just fine.

I just noticed that /usr/bin/kill doesn't handle -N signals, where -N is
a number in 1.5.4.  That's due to the recent inclusion of getopt into
the DLL.  I fixed this recently and, if you download a recent snapshot,
this particular problem would be solved.  Unfortunately, you'd be trading
this problem for other odd signal problems so I wouldn't recommend using
a snapshot quite yet.

cgf

--
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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Problem with stopping postmaster with pg_ctl
  2003-09-16 20:53 ` Igor Pechtchanski
  2003-09-16 21:12   ` John Pagakis
  2003-09-16 21:53   ` John Pagakis
@ 2003-09-17 15:28   ` John Pagakis
  2003-09-17 15:50   ` John Pagakis
  3 siblings, 0 replies; 11+ messages in thread
From: John Pagakis @ 2003-09-17 15:28 UTC (permalink / raw)
  To: cygwin

Here is what I have found and surmised .....

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 /etc/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, to work around this problem 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.

You are now shut down.

__________________________________________________________________
John Pagakis
Email: john@pagakis.com

We dance around in a ring and suppose,
   But the Secret sits in the middle and knows.
       -- Robert Frost

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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Problem with stopping postmaster with pg_ctl
  2003-09-16 20:53 ` Igor Pechtchanski
                     ` (2 preceding siblings ...)
  2003-09-17 15:28   ` John Pagakis
@ 2003-09-17 15:50   ` John Pagakis
  2003-09-17 16:18     ` Igor Pechtchanski
  3 siblings, 1 reply; 11+ messages in thread
From: John Pagakis @ 2003-09-17 15:50 UTC (permalink / raw)
  To: cygwin

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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Problem with stopping postmaster with pg_ctl
  2003-09-17 15:50   ` John Pagakis
@ 2003-09-17 16:18     ` Igor Pechtchanski
  2003-09-17 16:40       ` John Pagakis
  0 siblings, 1 reply; 11+ messages in thread
From: Igor Pechtchanski @ 2003-09-17 16:18 UTC (permalink / raw)
  To: John Pagakis; +Cc: cygwin

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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Problem with stopping postmaster with pg_ctl
  2003-09-17 16:18     ` Igor Pechtchanski
@ 2003-09-17 16:40       ` John Pagakis
  2003-09-17 17:09         ` Igor Pechtchanski
  0 siblings, 1 reply; 11+ messages in thread
From: John Pagakis @ 2003-09-17 16:40 UTC (permalink / raw)
  To: cygwin, pgsql-cygwin

That did the trick Igor!! Thanks so much!!

For any with the same problem, here's the revised script:

#! /bin/sh
#-------------------------------------------------------------------------
#
# pg_ctl.sh--
#    Start/Stop/Restart/HUP/Report status of postmaster
#
# Copyright (c) 2001  PostgreSQL Global Development Group
#
#
# IDENTIFICATION
#    $Header: /cvsroot/pgsql-server/src/bin/pg_ctl/pg_ctl.sh,v 1.30
2002/10/18 22:05:35 petere Exp $
#
#-------------------------------------------------------------------------

CMDNAME=`basename $0`

help="\
$CMDNAME is a utility to start, stop, restart, reload configuration files,
or report the status of a PostgreSQL server.

Usage:
  $CMDNAME start   [-w] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]
  $CMDNAME stop    [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]
  $CMDNAME restart [-w] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] [-o
\"OPTIONS\"]
  $CMDNAME reload  [-D DATADIR] [-s]
  $CMDNAME status  [-D DATADIR]

Common options:
  -D DATADIR   location of the database storage area
  -s           only print errors, no informational messages
  -w           wait until operation completes
  -W           do not wait until operation completes
  --help       show this help, then exit
  --version    output version information, then exit
(The default is to wait for shutdown, but not for start or restart.)

If the -D option is omitted, the environment variable PGDATA is used.

Options for start or restart:
  -l FILENAME             write (or append) server log to FILENAME.  The
                          use of this option is highly recommended.
  -o OPTIONS              command line options to pass to the postmaster
                          (PostgreSQL server executable)
  -p PATH-TO-POSTMASTER   normally not necessary

Options for stop or restart:
  -m SHUTDOWN-MODE   may be 'smart', 'fast', or 'immediate'

Shutdown modes are:
  smart       quit after all clients have disconnected
  fast        quit directly, with proper shutdown
  immediate   quit without complete shutdown; will lead to recovery on
restart

Report bugs to <pgsql-bugs@postgresql.org>."

advice="\
Try '$CMDNAME --help' for more information."


# Placed here during build
bindir='/usr/bin'
VERSION='7.3.4'

# protect the log file
umask 077

# Check for echo -n vs echo \c

if echo '\c' | grep -s c >/dev/null 2>&1
then
    ECHO_N="echo -n"
    ECHO_C=""
else
    ECHO_N="echo"
    ECHO_C='\c'
fi

#
# Find out where we're located
#
if echo "$0" | grep '/' > /dev/null 2>&1
then
        # explicit dir name given
        self_path=`echo "$0" | sed 's,/[^/]*$,,'`       # (dirname command
is not portable)
else
        # look for it in PATH ('which' command is not portable)
        for dir in `echo "$PATH" | sed 's/:/ /g'`
	do
                # empty entry in path means current dir
                [ -z "$dir" ] && dir='.'
                if [ -f "$dir/$CMDNAME" ]
		then
                        self_path="$dir"
                        break
                fi
        done
fi

# Check if needed programs actually exist in path
if [ -x "$self_path/postmaster" ] && [ -x "$self_path/psql" ]; then
    PGPATH="$self_path"
elif [ -x "$bindir/postmaster" ] && [ -x "$bindir/psql" ]; then
    PGPATH="$bindir"
else
    echo "The programs 'postmaster' and 'psql' are needed by $CMDNAME but"
1>&2
    echo "were not found in the directory '$bindir'." 1>&2
    echo "Check your installation." 1>&2
    exit 1
fi

po_path="$PGPATH/postmaster"

wait=
wait_seconds=60
logfile=
silence_echo=
shutdown_mode=smart

while [ "$#" -gt 0 ]
do
    case "$1" in
	-h|--help|-\?)
	    echo "$help"
	    exit 0
	    ;;
        -V|--version)
	    echo "pg_ctl (PostgreSQL) $VERSION"
	    exit 0
	    ;;
	-D)
	    shift
	    # pass environment into new postmaster
	    PGDATA="$1"
	    export PGDATA
	    ;;
	-l)
	    logfile="$2"
	    shift;;
	-l*)
	    logfile=`echo "$1" | sed 's/^-l//'`
	    ;;
	-m)
	    shutdown_mode="$2"
	    shift;;
	-m*)
	    shutdown_mode=`echo "$1" | sed 's/^-m//'`
	    ;;
	-o)
	    shift
	    POSTOPTS="$1"
	    ;;
	-p)
	    shift
	    po_path="$1"
	    ;;
	-s)
	    silence_echo=:
	    ;;
	-w)
	    wait=yes
	    ;;
	-W)
	    wait=no
	    ;;
	-*)
	    echo "$CMDNAME: invalid option: $1" 1>&2
	    echo "$advice" 1>&2
	    exit 1
	    ;;
	start)
	    op="start"
	    ;;
	stop)
	    op="stop"
	    ;;
	restart)
	    op="restart"
	    ;;
	reload)
	    op="reload"
	    ;;
	status)
	    op="status"
	    ;;
	*)
	    echo "$CMDNAME: invalid operation mode: $1" 1>&2
	    echo "$advice" 1>&2
	    exit 1
	    ;;
    esac
    shift
done

if [ x"$op" = x"" ];then
    echo "$CMDNAME: no operation mode specified" 1>&2
    echo "$advice" 1>&2
    exit 1
fi

if [ -z "$PGDATA" ];then
    echo "$CMDNAME: no database directory or environment variable \$PGDATA
is specified" 1>&2
    echo "$advice" 1>&2
    exit 1
fi

if [ -z "$wait" ]; then
    case "$op" in
	start)      wait=no;;
	stop)       wait=yes;;
	restart)    wait=no;;   # must wait on shutdown anyhow
    esac
fi


case "$shutdown_mode" in
    s|smart)
	sig="-TERM"
        sig="-s 15"
	;;
    f|fast)
	sig="-INT"
        sig="-s 2"
	;;
    i|immediate)
	sig="-QUIT"
        sig="-s 3"
	;;
    *)
	echo "$CMDNAME: invalid shutdown mode: $1" 1>&2
	echo "$advice" 1>&2
	exit 1
	;;
esac

if [ "$op" = "reload" ];then
	sig="-HUP"
	wait=no
fi

DEFPOSTOPTS=$PGDATA/postmaster.opts.default
POSTOPTSFILE=$PGDATA/postmaster.opts
PIDFILE=$PGDATA/postmaster.pid

if [ "$op" = "status" ];then
    if [ -f "$PIDFILE" ];then
	PID=`sed -n 1p $PIDFILE`
	if [ "$PID" -lt 0 ];then
	    PID=`expr 0 - $PID`
	    echo "$CMDNAME: postgres is running (pid: $PID)"
	else
	    echo "$CMDNAME: postmaster is running (pid: $PID)"
	    echo "Command line was:"
	    cat "$POSTOPTSFILE"
	fi
	exit 0
    else
	echo "$CMDNAME: postmaster or postgres is not running"
	exit 1
    fi
fi

if [ "$op" = "stop" -o "$op" = "restart" -o "$op" = "reload" ];then
    if [ -f "$PIDFILE" ];then
	PID=`sed -n 1p $PIDFILE`
	if [ "$PID" -lt 0 ];then
	    PID=`expr 0 - $PID`
	    echo "$CMDNAME: Cannot restart postmaster.  postgres is running (pid:
$PID)" 1>&2
	    echo "Please terminate postgres and try again." 1>&2
	    exit 1
	fi

	kill "$sig" $PID

	# wait for postmaster to shut down
	if [ "$wait" = yes -o "$op" = restart ];then
	    cnt=0
	    $silence_echo $ECHO_N "waiting for postmaster to shut down..."$ECHO_C

	    while :
	    do
		if [ -f "$PIDFILE" ];then
		    $silence_echo $ECHO_N "."$ECHO_C
		    cnt=`expr $cnt + 1`
		    if [ "$cnt" -gt "$wait_seconds" ];then
			$silence_echo echo " failed"
			echo "$CMDNAME: postmaster does not shut down" 1>&2
			exit 1
		    fi
		else
		    break
		fi
		sleep 1
	    done
	    $silence_echo echo "done"
	fi

	if [ "$op" = "reload" ];then
	    $silence_echo echo "postmaster successfully signaled"
	else
	    $silence_echo echo "postmaster successfully shut down"
	fi

    else # ! -f $PIDFILE
	echo "$CMDNAME: cannot find $PIDFILE" 1>&2
	echo "Is postmaster running?" 1>&2
	if [ "$op" = "restart" ];then
	    echo "starting postmaster anyway" 1>&2
	else
	    exit 1
	fi
    fi
fi # stop, restart, reload

if [ "$op" = "start" -o "$op" = "restart" ];then
    oldpid=""
    if [ -f "$PIDFILE" ];then
	echo "$CMDNAME: Another postmaster may be running.  Trying to start
postmaster anyway." 1>&2
	oldpid=`sed -n 1p $PIDFILE`
    fi

    # no -o given
    if [ -z "$POSTOPTS" ];then
	if [ "$op" = "start" ];then
	    # if we are in start mode, then look for postmaster.opts.default
	    if [ -f "$DEFPOSTOPTS" ]; then
		eval set X "`cat $DEFPOSTOPTS`"; shift
	    fi
	else
	    # if we are in restart mode, then look for postmaster.opts
	    eval set X "`cat $POSTOPTSFILE`"; shift
            po_path="$1"
            shift
	fi
    else # -o given
        eval set X "$POSTOPTS"; shift
    fi

    if [ -n "$logfile" ]; then
        "$po_path" ${1+"$@"} </dev/null >>$logfile 2>&1 &
    else
        # when starting without log file, redirect stderr to stdout, so
        # pg_ctl can be invoked with >$logfile and still have pg_ctl's
        # stderr on the terminal.
        "$po_path" ${1+"$@"} </dev/null 2>&1 &
    fi

    # if had an old lockfile, check to see if we were able to start
    if [ -n "$oldpid" ];then
	sleep 1
	if [ -f "$PIDFILE" ];then
	    if [ "`sed -n 1p $PIDFILE`" = "$oldpid" ];then
		echo "$CMDNAME: cannot start postmaster" 1>&2
		echo "Examine the log output." 1>&2
		exit 1
	    fi
        fi
    fi

    # wait for postmaster to start
    if [ "$wait" = yes ];then
	cnt=0
	$silence_echo $ECHO_N "waiting for postmaster to start..."$ECHO_C
	while :
	do
# FIXME:  This is horribly misconceived.
# 1) If password authentication is set up, the connection will fail.
# 2) If a virtual host is set up, the connection may fail.
# 3) If network traffic filters are set up tight enough, the connection
#    may fail.
# 4) When no Unix domain sockets are available, the connection will
#    fail.  (Using TCP/IP by default ain't better.)
# 5) When a different port is configured, the connection will fail
#    or go to the wrong server.
# 6) If the dynamic loader is not set up correctly (for this user/at
#    this time), psql will fail (to find libpq).
# 7) If psql is misconfigured, this may fail.
	    if "$PGPATH/psql" -l >/dev/null 2>&1
	    then
		break;
	    else
		$silence_echo $ECHO_N "."$ECHO_C
		cnt=`expr $cnt + 1`
		if [ "$cnt" -gt "$wait_seconds" ];then
		    $silence_echo echo "failed"
		    echo "$CMDNAME: postmaster does not start" 1>&2
		    exit 1
		fi
		sleep 1
	    fi
	done
	$silence_echo echo "done"
    fi
    $silence_echo echo "postmaster successfully started"
fi # start or restart

exit 0

__________________________________________________________________
John Pagakis
Email: john@pagakis.com

Cheese -- Milk's leap towards immortality.
       -- Clifton Fadiman

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: Wednesday, September 17, 2003 8:51 AM
To: John Pagakis
Cc: cygwin@cygwin.com
Subject: 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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Problem with stopping postmaster with pg_ctl
  2003-09-17 16:40       ` John Pagakis
@ 2003-09-17 17:09         ` Igor Pechtchanski
  2003-09-17 17:43           ` John Pagakis
  0 siblings, 1 reply; 11+ messages in thread
From: Igor Pechtchanski @ 2003-09-17 17:09 UTC (permalink / raw)
  To: John Pagakis; +Cc: cygwin, pgsql-cygwin

John,

FWIW, you forgot SIGHUP (="-s 1").
	Igor

On Wed, 17 Sep 2003, John Pagakis wrote:

> That did the trick Igor!! Thanks so much!!
>
> For any with the same problem, here's the revised script:
>
> #! /bin/sh
> #-------------------------------------------------------------------------
> #
> # pg_ctl.sh--
> #    Start/Stop/Restart/HUP/Report status of postmaster
> #
> # Copyright (c) 2001  PostgreSQL Global Development Group
> #
> #
> # IDENTIFICATION
> #    $Header: /cvsroot/pgsql-server/src/bin/pg_ctl/pg_ctl.sh,v 1.30
> 2002/10/18 22:05:35 petere Exp $
> #
> #-------------------------------------------------------------------------
>
> CMDNAME=`basename $0`
>
> help="\
> $CMDNAME is a utility to start, stop, restart, reload configuration files,
> or report the status of a PostgreSQL server.
>
> Usage:
>   $CMDNAME start   [-w] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]
>   $CMDNAME stop    [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]
>   $CMDNAME restart [-w] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] [-o
> \"OPTIONS\"]
>   $CMDNAME reload  [-D DATADIR] [-s]
>   $CMDNAME status  [-D DATADIR]
>
> Common options:
>   -D DATADIR   location of the database storage area
>   -s           only print errors, no informational messages
>   -w           wait until operation completes
>   -W           do not wait until operation completes
>   --help       show this help, then exit
>   --version    output version information, then exit
> (The default is to wait for shutdown, but not for start or restart.)
>
> If the -D option is omitted, the environment variable PGDATA is used.
>
> Options for start or restart:
>   -l FILENAME             write (or append) server log to FILENAME.  The
>                           use of this option is highly recommended.
>   -o OPTIONS              command line options to pass to the postmaster
>                           (PostgreSQL server executable)
>   -p PATH-TO-POSTMASTER   normally not necessary
>
> Options for stop or restart:
>   -m SHUTDOWN-MODE   may be 'smart', 'fast', or 'immediate'
>
> Shutdown modes are:
>   smart       quit after all clients have disconnected
>   fast        quit directly, with proper shutdown
>   immediate   quit without complete shutdown; will lead to recovery on
> restart
>
> Report bugs to <pgsql-bugs@postgresql.org>."
>
> advice="\
> Try '$CMDNAME --help' for more information."
>
>
> # Placed here during build
> bindir='/usr/bin'
> VERSION='7.3.4'
>
> # protect the log file
> umask 077
>
> # Check for echo -n vs echo \c
>
> if echo '\c' | grep -s c >/dev/null 2>&1
> then
>     ECHO_N="echo -n"
>     ECHO_C=""
> else
>     ECHO_N="echo"
>     ECHO_C='\c'
> fi
>
> #
> # Find out where we're located
> #
> if echo "$0" | grep '/' > /dev/null 2>&1
> then
>         # explicit dir name given
>         self_path=`echo "$0" | sed 's,/[^/]*$,,'`       # (dirname command
> is not portable)
> else
>         # look for it in PATH ('which' command is not portable)
>         for dir in `echo "$PATH" | sed 's/:/ /g'`
>         do
>                 # empty entry in path means current dir
>                 [ -z "$dir" ] && dir='.'
>                 if [ -f "$dir/$CMDNAME" ]
>                 then
>                         self_path="$dir"
>                         break
>                 fi
>         done
> fi
>
> # Check if needed programs actually exist in path
> if [ -x "$self_path/postmaster" ] && [ -x "$self_path/psql" ]; then
>     PGPATH="$self_path"
> elif [ -x "$bindir/postmaster" ] && [ -x "$bindir/psql" ]; then
>     PGPATH="$bindir"
> else
>     echo "The programs 'postmaster' and 'psql' are needed by $CMDNAME but"
> 1>&2
>     echo "were not found in the directory '$bindir'." 1>&2
>     echo "Check your installation." 1>&2
>     exit 1
> fi
>
> po_path="$PGPATH/postmaster"
>
> wait=
> wait_seconds=60
> logfile=
> silence_echo=
> shutdown_mode=smart
>
> while [ "$#" -gt 0 ]
> do
>     case "$1" in
>         -h|--help|-\?)
>             echo "$help"
>             exit 0
>             ;;
>         -V|--version)
>             echo "pg_ctl (PostgreSQL) $VERSION"
>             exit 0
>             ;;
>         -D)
>             shift
>             # pass environment into new postmaster
>             PGDATA="$1"
>             export PGDATA
>             ;;
>         -l)
>             logfile="$2"
>             shift;;
>         -l*)
>             logfile=`echo "$1" | sed 's/^-l//'`
>             ;;
>         -m)
>             shutdown_mode="$2"
>             shift;;
>         -m*)
>             shutdown_mode=`echo "$1" | sed 's/^-m//'`
>             ;;
>         -o)
>             shift
>             POSTOPTS="$1"
>             ;;
>         -p)
>             shift
>             po_path="$1"
>             ;;
>         -s)
>             silence_echo=:
>             ;;
>         -w)
>             wait=yes
>             ;;
>         -W)
>             wait=no
>             ;;
>         -*)
>             echo "$CMDNAME: invalid option: $1" 1>&2
>             echo "$advice" 1>&2
>             exit 1
>             ;;
>         start)
>             op="start"
>             ;;
>         stop)
>             op="stop"
>             ;;
>         restart)
>             op="restart"
>             ;;
>         reload)
>             op="reload"
>             ;;
>         status)
>             op="status"
>             ;;
>         *)
>             echo "$CMDNAME: invalid operation mode: $1" 1>&2
>             echo "$advice" 1>&2
>             exit 1
>             ;;
>     esac
>     shift
> done
>
> if [ x"$op" = x"" ];then
>     echo "$CMDNAME: no operation mode specified" 1>&2
>     echo "$advice" 1>&2
>     exit 1
> fi
>
> if [ -z "$PGDATA" ];then
>     echo "$CMDNAME: no database directory or environment variable \$PGDATA
> is specified" 1>&2
>     echo "$advice" 1>&2
>     exit 1
> fi
>
> if [ -z "$wait" ]; then
>     case "$op" in
>         start)      wait=no;;
>         stop)       wait=yes;;
>         restart)    wait=no;;   # must wait on shutdown anyhow
>     esac
> fi
>
>
> case "$shutdown_mode" in
>     s|smart)
>         sig="-TERM"
>         sig="-s 15"
>         ;;
>     f|fast)
>         sig="-INT"
>         sig="-s 2"
>         ;;
>     i|immediate)
>         sig="-QUIT"
>         sig="-s 3"
>         ;;
>     *)
>         echo "$CMDNAME: invalid shutdown mode: $1" 1>&2
>         echo "$advice" 1>&2
>         exit 1
>         ;;
> esac
>
> if [ "$op" = "reload" ];then
>         sig="-HUP"
>         wait=no
> fi
>
> DEFPOSTOPTS=$PGDATA/postmaster.opts.default
> POSTOPTSFILE=$PGDATA/postmaster.opts
> PIDFILE=$PGDATA/postmaster.pid
>
> if [ "$op" = "status" ];then
>     if [ -f "$PIDFILE" ];then
>         PID=`sed -n 1p $PIDFILE`
>         if [ "$PID" -lt 0 ];then
>             PID=`expr 0 - $PID`
>             echo "$CMDNAME: postgres is running (pid: $PID)"
>         else
>             echo "$CMDNAME: postmaster is running (pid: $PID)"
>             echo "Command line was:"
>             cat "$POSTOPTSFILE"
>         fi
>         exit 0
>     else
>         echo "$CMDNAME: postmaster or postgres is not running"
>         exit 1
>     fi
> fi
>
> if [ "$op" = "stop" -o "$op" = "restart" -o "$op" = "reload" ];then
>     if [ -f "$PIDFILE" ];then
>         PID=`sed -n 1p $PIDFILE`
>         if [ "$PID" -lt 0 ];then
>             PID=`expr 0 - $PID`
>             echo "$CMDNAME: Cannot restart postmaster.  postgres is running (pid:
> $PID)" 1>&2
>             echo "Please terminate postgres and try again." 1>&2
>             exit 1
>         fi
>
>         kill "$sig" $PID
>
>         # wait for postmaster to shut down
>         if [ "$wait" = yes -o "$op" = restart ];then
>             cnt=0
>             $silence_echo $ECHO_N "waiting for postmaster to shut down..."$ECHO_C
>
>             while :
>             do
>                 if [ -f "$PIDFILE" ];then
>                     $silence_echo $ECHO_N "."$ECHO_C
>                     cnt=`expr $cnt + 1`
>                     if [ "$cnt" -gt "$wait_seconds" ];then
>                         $silence_echo echo " failed"
>                         echo "$CMDNAME: postmaster does not shut down" 1>&2
>                         exit 1
>                     fi
>                 else
>                     break
>                 fi
>                 sleep 1
>             done
>             $silence_echo echo "done"
>         fi
>
>         if [ "$op" = "reload" ];then
>             $silence_echo echo "postmaster successfully signaled"
>         else
>             $silence_echo echo "postmaster successfully shut down"
>         fi
>
>     else # ! -f $PIDFILE
>         echo "$CMDNAME: cannot find $PIDFILE" 1>&2
>         echo "Is postmaster running?" 1>&2
>         if [ "$op" = "restart" ];then
>             echo "starting postmaster anyway" 1>&2
>         else
>             exit 1
>         fi
>     fi
> fi # stop, restart, reload
>
> if [ "$op" = "start" -o "$op" = "restart" ];then
>     oldpid=""
>     if [ -f "$PIDFILE" ];then
>         echo "$CMDNAME: Another postmaster may be running.  Trying to start
> postmaster anyway." 1>&2
>         oldpid=`sed -n 1p $PIDFILE`
>     fi
>
>     # no -o given
>     if [ -z "$POSTOPTS" ];then
>         if [ "$op" = "start" ];then
>             # if we are in start mode, then look for postmaster.opts.default
>             if [ -f "$DEFPOSTOPTS" ]; then
>                 eval set X "`cat $DEFPOSTOPTS`"; shift
>             fi
>         else
>             # if we are in restart mode, then look for postmaster.opts
>             eval set X "`cat $POSTOPTSFILE`"; shift
>             po_path="$1"
>             shift
>         fi
>     else # -o given
>         eval set X "$POSTOPTS"; shift
>     fi
>
>     if [ -n "$logfile" ]; then
>         "$po_path" ${1+"$@"} </dev/null >>$logfile 2>&1 &
>     else
>         # when starting without log file, redirect stderr to stdout, so
>         # pg_ctl can be invoked with >$logfile and still have pg_ctl's
>         # stderr on the terminal.
>         "$po_path" ${1+"$@"} </dev/null 2>&1 &
>     fi
>
>     # if had an old lockfile, check to see if we were able to start
>     if [ -n "$oldpid" ];then
>         sleep 1
>         if [ -f "$PIDFILE" ];then
>             if [ "`sed -n 1p $PIDFILE`" = "$oldpid" ];then
>                 echo "$CMDNAME: cannot start postmaster" 1>&2
>                 echo "Examine the log output." 1>&2
>                 exit 1
>             fi
>         fi
>     fi
>
>     # wait for postmaster to start
>     if [ "$wait" = yes ];then
>         cnt=0
>         $silence_echo $ECHO_N "waiting for postmaster to start..."$ECHO_C
>         while :
>         do
> # FIXME:  This is horribly misconceived.
> # 1) If password authentication is set up, the connection will fail.
> # 2) If a virtual host is set up, the connection may fail.
> # 3) If network traffic filters are set up tight enough, the connection
> #    may fail.
> # 4) When no Unix domain sockets are available, the connection will
> #    fail.  (Using TCP/IP by default ain't better.)
> # 5) When a different port is configured, the connection will fail
> #    or go to the wrong server.
> # 6) If the dynamic loader is not set up correctly (for this user/at
> #    this time), psql will fail (to find libpq).
> # 7) If psql is misconfigured, this may fail.
>             if "$PGPATH/psql" -l >/dev/null 2>&1
>             then
>                 break;
>             else
>                 $silence_echo $ECHO_N "."$ECHO_C
>                 cnt=`expr $cnt + 1`
>                 if [ "$cnt" -gt "$wait_seconds" ];then
>                     $silence_echo echo "failed"
>                     echo "$CMDNAME: postmaster does not start" 1>&2
>                     exit 1
>                 fi
>                 sleep 1
>             fi
>         done
>         $silence_echo echo "done"
>     fi
>     $silence_echo echo "postmaster successfully started"
> fi # start or restart
>
> exit 0
>
> __________________________________________________________________
> John Pagakis
> Email: john@pagakis.com
>
> Cheese -- Milk's leap towards immortality.
>        -- Clifton Fadiman
>
> 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: Wednesday, September 17, 2003 8:51 AM
> To: John Pagakis
> Cc: cygwin@cygwin.com
> Subject: 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/
>

-- 
				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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Problem with stopping postmaster with pg_ctl
  2003-09-17 17:09         ` Igor Pechtchanski
@ 2003-09-17 17:43           ` John Pagakis
  0 siblings, 0 replies; 11+ messages in thread
From: John Pagakis @ 2003-09-17 17:43 UTC (permalink / raw)
  To: cygwin, pgsql-cygwin

My bad!!  Thanks!!

Here's the new work-around script .......

#! /bin/sh
#-------------------------------------------------------------------------
#
# pg_ctl.sh--
#    Start/Stop/Restart/HUP/Report status of postmaster
#
# Copyright (c) 2001  PostgreSQL Global Development Group
#
#
# IDENTIFICATION
#    $Header: /cvsroot/pgsql-server/src/bin/pg_ctl/pg_ctl.sh,v 1.30
2002/10/18 22:05:35 petere Exp $
#
#-------------------------------------------------------------------------

CMDNAME=`basename $0`

help="\
$CMDNAME is a utility to start, stop, restart, reload configuration files,
or report the status of a PostgreSQL server.

Usage:
  $CMDNAME start   [-w] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]
  $CMDNAME stop    [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]
  $CMDNAME restart [-w] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] [-o
\"OPTIONS\"]
  $CMDNAME reload  [-D DATADIR] [-s]
  $CMDNAME status  [-D DATADIR]

Common options:
  -D DATADIR   location of the database storage area
  -s           only print errors, no informational messages
  -w           wait until operation completes
  -W           do not wait until operation completes
  --help       show this help, then exit
  --version    output version information, then exit
(The default is to wait for shutdown, but not for start or restart.)

If the -D option is omitted, the environment variable PGDATA is used.

Options for start or restart:
  -l FILENAME             write (or append) server log to FILENAME.  The
                          use of this option is highly recommended.
  -o OPTIONS              command line options to pass to the postmaster
                          (PostgreSQL server executable)
  -p PATH-TO-POSTMASTER   normally not necessary

Options for stop or restart:
  -m SHUTDOWN-MODE   may be 'smart', 'fast', or 'immediate'

Shutdown modes are:
  smart       quit after all clients have disconnected
  fast        quit directly, with proper shutdown
  immediate   quit without complete shutdown; will lead to recovery on
restart

Report bugs to <pgsql-bugs@postgresql.org>."

advice="\
Try '$CMDNAME --help' for more information."


# Placed here during build
bindir='/usr/bin'
VERSION='7.3.4'

# protect the log file
umask 077

# Check for echo -n vs echo \c

if echo '\c' | grep -s c >/dev/null 2>&1
then
    ECHO_N="echo -n"
    ECHO_C=""
else
    ECHO_N="echo"
    ECHO_C='\c'
fi

#
# Find out where we're located
#
if echo "$0" | grep '/' > /dev/null 2>&1
then
        # explicit dir name given
        self_path=`echo "$0" | sed 's,/[^/]*$,,'`       # (dirname command
is not portable)
else
        # look for it in PATH ('which' command is not portable)
        for dir in `echo "$PATH" | sed 's/:/ /g'`
	do
                # empty entry in path means current dir
                [ -z "$dir" ] && dir='.'
                if [ -f "$dir/$CMDNAME" ]
		then
                        self_path="$dir"
                        break
                fi
        done
fi

# Check if needed programs actually exist in path
if [ -x "$self_path/postmaster" ] && [ -x "$self_path/psql" ]; then
    PGPATH="$self_path"
elif [ -x "$bindir/postmaster" ] && [ -x "$bindir/psql" ]; then
    PGPATH="$bindir"
else
    echo "The programs 'postmaster' and 'psql' are needed by $CMDNAME but"
1>&2
    echo "were not found in the directory '$bindir'." 1>&2
    echo "Check your installation." 1>&2
    exit 1
fi

po_path="$PGPATH/postmaster"

wait=
wait_seconds=60
logfile=
silence_echo=
shutdown_mode=smart

while [ "$#" -gt 0 ]
do
    case "$1" in
	-h|--help|-\?)
	    echo "$help"
	    exit 0
	    ;;
        -V|--version)
	    echo "pg_ctl (PostgreSQL) $VERSION"
	    exit 0
	    ;;
	-D)
	    shift
	    # pass environment into new postmaster
	    PGDATA="$1"
	    export PGDATA
	    ;;
	-l)
	    logfile="$2"
	    shift;;
	-l*)
	    logfile=`echo "$1" | sed 's/^-l//'`
	    ;;
	-m)
	    shutdown_mode="$2"
	    shift;;
	-m*)
	    shutdown_mode=`echo "$1" | sed 's/^-m//'`
	    ;;
	-o)
	    shift
	    POSTOPTS="$1"
	    ;;
	-p)
	    shift
	    po_path="$1"
	    ;;
	-s)
	    silence_echo=:
	    ;;
	-w)
	    wait=yes
	    ;;
	-W)
	    wait=no
	    ;;
	-*)
	    echo "$CMDNAME: invalid option: $1" 1>&2
	    echo "$advice" 1>&2
	    exit 1
	    ;;
	start)
	    op="start"
	    ;;
	stop)
	    op="stop"
	    ;;
	restart)
	    op="restart"
	    ;;
	reload)
	    op="reload"
	    ;;
	status)
	    op="status"
	    ;;
	*)
	    echo "$CMDNAME: invalid operation mode: $1" 1>&2
	    echo "$advice" 1>&2
	    exit 1
	    ;;
    esac
    shift
done

if [ x"$op" = x"" ];then
    echo "$CMDNAME: no operation mode specified" 1>&2
    echo "$advice" 1>&2
    exit 1
fi

if [ -z "$PGDATA" ];then
    echo "$CMDNAME: no database directory or environment variable \$PGDATA
is specified" 1>&2
    echo "$advice" 1>&2
    exit 1
fi

if [ -z "$wait" ]; then
    case "$op" in
	start)      wait=no;;
	stop)       wait=yes;;
	restart)    wait=no;;   # must wait on shutdown anyhow
    esac
fi


case "$shutdown_mode" in
    s|smart)
	sig="-TERM"
        sig="-s 15"
	;;
    f|fast)
	sig="-INT"
        sig="-s 2"
	;;
    i|immediate)
	sig="-QUIT"
        sig="-s 3"
	;;
    *)
	echo "$CMDNAME: invalid shutdown mode: $1" 1>&2
	echo "$advice" 1>&2
	exit 1
	;;
esac

if [ "$op" = "reload" ];then
	sig="-HUP"
	sig="-s 1"
	wait=no
fi

DEFPOSTOPTS=$PGDATA/postmaster.opts.default
POSTOPTSFILE=$PGDATA/postmaster.opts
PIDFILE=$PGDATA/postmaster.pid

if [ "$op" = "status" ];then
    if [ -f "$PIDFILE" ];then
	PID=`sed -n 1p $PIDFILE`
	if [ "$PID" -lt 0 ];then
	    PID=`expr 0 - $PID`
	    echo "$CMDNAME: postgres is running (pid: $PID)"
	else
	    echo "$CMDNAME: postmaster is running (pid: $PID)"
	    echo "Command line was:"
	    cat "$POSTOPTSFILE"
	fi
	exit 0
    else
	echo "$CMDNAME: postmaster or postgres is not running"
	exit 1
    fi
fi

if [ "$op" = "stop" -o "$op" = "restart" -o "$op" = "reload" ];then
    if [ -f "$PIDFILE" ];then
	PID=`sed -n 1p $PIDFILE`
	if [ "$PID" -lt 0 ];then
	    PID=`expr 0 - $PID`
	    echo "$CMDNAME: Cannot restart postmaster.  postgres is running (pid:
$PID)" 1>&2
	    echo "Please terminate postgres and try again." 1>&2
	    exit 1
	fi

	kill "$sig" $PID

	# wait for postmaster to shut down
	if [ "$wait" = yes -o "$op" = restart ];then
	    cnt=0
	    $silence_echo $ECHO_N "waiting for postmaster to shut down..."$ECHO_C

	    while :
	    do
		if [ -f "$PIDFILE" ];then
		    $silence_echo $ECHO_N "."$ECHO_C
		    cnt=`expr $cnt + 1`
		    if [ "$cnt" -gt "$wait_seconds" ];then
			$silence_echo echo " failed"
			echo "$CMDNAME: postmaster does not shut down" 1>&2
			exit 1
		    fi
		else
		    break
		fi
		sleep 1
	    done
	    $silence_echo echo "done"
	fi

	if [ "$op" = "reload" ];then
	    $silence_echo echo "postmaster successfully signaled"
	else
	    $silence_echo echo "postmaster successfully shut down"
	fi

    else # ! -f $PIDFILE
	echo "$CMDNAME: cannot find $PIDFILE" 1>&2
	echo "Is postmaster running?" 1>&2
	if [ "$op" = "restart" ];then
	    echo "starting postmaster anyway" 1>&2
	else
	    exit 1
	fi
    fi
fi # stop, restart, reload

if [ "$op" = "start" -o "$op" = "restart" ];then
    oldpid=""
    if [ -f "$PIDFILE" ];then
	echo "$CMDNAME: Another postmaster may be running.  Trying to start
postmaster anyway." 1>&2
	oldpid=`sed -n 1p $PIDFILE`
    fi

    # no -o given
    if [ -z "$POSTOPTS" ];then
	if [ "$op" = "start" ];then
	    # if we are in start mode, then look for postmaster.opts.default
	    if [ -f "$DEFPOSTOPTS" ]; then
		eval set X "`cat $DEFPOSTOPTS`"; shift
	    fi
	else
	    # if we are in restart mode, then look for postmaster.opts
	    eval set X "`cat $POSTOPTSFILE`"; shift
            po_path="$1"
            shift
	fi
    else # -o given
        eval set X "$POSTOPTS"; shift
    fi

    if [ -n "$logfile" ]; then
        "$po_path" ${1+"$@"} </dev/null >>$logfile 2>&1 &
    else
        # when starting without log file, redirect stderr to stdout, so
        # pg_ctl can be invoked with >$logfile and still have pg_ctl's
        # stderr on the terminal.
        "$po_path" ${1+"$@"} </dev/null 2>&1 &
    fi

    # if had an old lockfile, check to see if we were able to start
    if [ -n "$oldpid" ];then
	sleep 1
	if [ -f "$PIDFILE" ];then
	    if [ "`sed -n 1p $PIDFILE`" = "$oldpid" ];then
		echo "$CMDNAME: cannot start postmaster" 1>&2
		echo "Examine the log output." 1>&2
		exit 1
	    fi
        fi
    fi

    # wait for postmaster to start
    if [ "$wait" = yes ];then
	cnt=0
	$silence_echo $ECHO_N "waiting for postmaster to start..."$ECHO_C
	while :
	do
# FIXME:  This is horribly misconceived.
# 1) If password authentication is set up, the connection will fail.
# 2) If a virtual host is set up, the connection may fail.
# 3) If network traffic filters are set up tight enough, the connection
#    may fail.
# 4) When no Unix domain sockets are available, the connection will
#    fail.  (Using TCP/IP by default ain't better.)
# 5) When a different port is configured, the connection will fail
#    or go to the wrong server.
# 6) If the dynamic loader is not set up correctly (for this user/at
#    this time), psql will fail (to find libpq).
# 7) If psql is misconfigured, this may fail.
	    if "$PGPATH/psql" -l >/dev/null 2>&1
	    then
		break;
	    else
		$silence_echo $ECHO_N "."$ECHO_C
		cnt=`expr $cnt + 1`
		if [ "$cnt" -gt "$wait_seconds" ];then
		    $silence_echo echo "failed"
		    echo "$CMDNAME: postmaster does not start" 1>&2
		    exit 1
		fi
		sleep 1
	    fi
	done
	$silence_echo echo "done"
    fi
    $silence_echo echo "postmaster successfully started"
fi # start or restart

exit 0

__________________________________________________________________
John Pagakis
Email: john@pagakis.com

"What we play is life."
        -- Louis Armstrong

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: Wednesday, September 17, 2003 10:05 AM
To: John Pagakis
Cc: cygwin@cygwin.com; pgsql-cygwin@postgresql.org
Subject: RE: Problem with stopping postmaster with pg_ctl


John,

FWIW, you forgot SIGHUP (="-s 1").
	Igor

On Wed, 17 Sep 2003, John Pagakis wrote:

> That did the trick Igor!! Thanks so much!!
>
> For any with the same problem, here's the revised script:
>
> #! /bin/sh
> #-------------------------------------------------------------------------
> #
> # pg_ctl.sh--
> #    Start/Stop/Restart/HUP/Report status of postmaster
> #
> # Copyright (c) 2001  PostgreSQL Global Development Group
> #
> #
> # IDENTIFICATION
> #    $Header: /cvsroot/pgsql-server/src/bin/pg_ctl/pg_ctl.sh,v 1.30
> 2002/10/18 22:05:35 petere Exp $
> #
> #-------------------------------------------------------------------------
>
> CMDNAME=`basename $0`
>
> help="\
> $CMDNAME is a utility to start, stop, restart, reload configuration files,
> or report the status of a PostgreSQL server.
>
> Usage:
>   $CMDNAME start   [-w] [-D DATADIR] [-s] [-l FILENAME] [-o \"OPTIONS\"]
>   $CMDNAME stop    [-W] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]
>   $CMDNAME restart [-w] [-D DATADIR] [-s] [-m SHUTDOWN-MODE] [-o
> \"OPTIONS\"]
>   $CMDNAME reload  [-D DATADIR] [-s]
>   $CMDNAME status  [-D DATADIR]
>
> Common options:
>   -D DATADIR   location of the database storage area
>   -s           only print errors, no informational messages
>   -w           wait until operation completes
>   -W           do not wait until operation completes
>   --help       show this help, then exit
>   --version    output version information, then exit
> (The default is to wait for shutdown, but not for start or restart.)
>
> If the -D option is omitted, the environment variable PGDATA is used.
>
> Options for start or restart:
>   -l FILENAME             write (or append) server log to FILENAME.  The
>                           use of this option is highly recommended.
>   -o OPTIONS              command line options to pass to the postmaster
>                           (PostgreSQL server executable)
>   -p PATH-TO-POSTMASTER   normally not necessary
>
> Options for stop or restart:
>   -m SHUTDOWN-MODE   may be 'smart', 'fast', or 'immediate'
>
> Shutdown modes are:
>   smart       quit after all clients have disconnected
>   fast        quit directly, with proper shutdown
>   immediate   quit without complete shutdown; will lead to recovery on
> restart
>
> Report bugs to <pgsql-bugs@postgresql.org>."
>
> advice="\
> Try '$CMDNAME --help' for more information."
>
>
> # Placed here during build
> bindir='/usr/bin'
> VERSION='7.3.4'
>
> # protect the log file
> umask 077
>
> # Check for echo -n vs echo \c
>
> if echo '\c' | grep -s c >/dev/null 2>&1
> then
>     ECHO_N="echo -n"
>     ECHO_C=""
> else
>     ECHO_N="echo"
>     ECHO_C='\c'
> fi
>
> #
> # Find out where we're located
> #
> if echo "$0" | grep '/' > /dev/null 2>&1
> then
>         # explicit dir name given
>         self_path=`echo "$0" | sed 's,/[^/]*$,,'`       # (dirname command
> is not portable)
> else
>         # look for it in PATH ('which' command is not portable)
>         for dir in `echo "$PATH" | sed 's/:/ /g'`
>         do
>                 # empty entry in path means current dir
>                 [ -z "$dir" ] && dir='.'
>                 if [ -f "$dir/$CMDNAME" ]
>                 then
>                         self_path="$dir"
>                         break
>                 fi
>         done
> fi
>
> # Check if needed programs actually exist in path
> if [ -x "$self_path/postmaster" ] && [ -x "$self_path/psql" ]; then
>     PGPATH="$self_path"
> elif [ -x "$bindir/postmaster" ] && [ -x "$bindir/psql" ]; then
>     PGPATH="$bindir"
> else
>     echo "The programs 'postmaster' and 'psql' are needed by $CMDNAME but"
> 1>&2
>     echo "were not found in the directory '$bindir'." 1>&2
>     echo "Check your installation." 1>&2
>     exit 1
> fi
>
> po_path="$PGPATH/postmaster"
>
> wait=
> wait_seconds=60
> logfile=
> silence_echo=
> shutdown_mode=smart
>
> while [ "$#" -gt 0 ]
> do
>     case "$1" in
>         -h|--help|-\?)
>             echo "$help"
>             exit 0
>             ;;
>         -V|--version)
>             echo "pg_ctl (PostgreSQL) $VERSION"
>             exit 0
>             ;;
>         -D)
>             shift
>             # pass environment into new postmaster
>             PGDATA="$1"
>             export PGDATA
>             ;;
>         -l)
>             logfile="$2"
>             shift;;
>         -l*)
>             logfile=`echo "$1" | sed 's/^-l//'`
>             ;;
>         -m)
>             shutdown_mode="$2"
>             shift;;
>         -m*)
>             shutdown_mode=`echo "$1" | sed 's/^-m//'`
>             ;;
>         -o)
>             shift
>             POSTOPTS="$1"
>             ;;
>         -p)
>             shift
>             po_path="$1"
>             ;;
>         -s)
>             silence_echo=:
>             ;;
>         -w)
>             wait=yes
>             ;;
>         -W)
>             wait=no
>             ;;
>         -*)
>             echo "$CMDNAME: invalid option: $1" 1>&2
>             echo "$advice" 1>&2
>             exit 1
>             ;;
>         start)
>             op="start"
>             ;;
>         stop)
>             op="stop"
>             ;;
>         restart)
>             op="restart"
>             ;;
>         reload)
>             op="reload"
>             ;;
>         status)
>             op="status"
>             ;;
>         *)
>             echo "$CMDNAME: invalid operation mode: $1" 1>&2
>             echo "$advice" 1>&2
>             exit 1
>             ;;
>     esac
>     shift
> done
>
> if [ x"$op" = x"" ];then
>     echo "$CMDNAME: no operation mode specified" 1>&2
>     echo "$advice" 1>&2
>     exit 1
> fi
>
> if [ -z "$PGDATA" ];then
>     echo "$CMDNAME: no database directory or environment variable \$PGDATA
> is specified" 1>&2
>     echo "$advice" 1>&2
>     exit 1
> fi
>
> if [ -z "$wait" ]; then
>     case "$op" in
>         start)      wait=no;;
>         stop)       wait=yes;;
>         restart)    wait=no;;   # must wait on shutdown anyhow
>     esac
> fi
>
>
> case "$shutdown_mode" in
>     s|smart)
>         sig="-TERM"
>         sig="-s 15"
>         ;;
>     f|fast)
>         sig="-INT"
>         sig="-s 2"
>         ;;
>     i|immediate)
>         sig="-QUIT"
>         sig="-s 3"
>         ;;
>     *)
>         echo "$CMDNAME: invalid shutdown mode: $1" 1>&2
>         echo "$advice" 1>&2
>         exit 1
>         ;;
> esac
>
> if [ "$op" = "reload" ];then
>         sig="-HUP"
>         wait=no
> fi
>
> DEFPOSTOPTS=$PGDATA/postmaster.opts.default
> POSTOPTSFILE=$PGDATA/postmaster.opts
> PIDFILE=$PGDATA/postmaster.pid
>
> if [ "$op" = "status" ];then
>     if [ -f "$PIDFILE" ];then
>         PID=`sed -n 1p $PIDFILE`
>         if [ "$PID" -lt 0 ];then
>             PID=`expr 0 - $PID`
>             echo "$CMDNAME: postgres is running (pid: $PID)"
>         else
>             echo "$CMDNAME: postmaster is running (pid: $PID)"
>             echo "Command line was:"
>             cat "$POSTOPTSFILE"
>         fi
>         exit 0
>     else
>         echo "$CMDNAME: postmaster or postgres is not running"
>         exit 1
>     fi
> fi
>
> if [ "$op" = "stop" -o "$op" = "restart" -o "$op" = "reload" ];then
>     if [ -f "$PIDFILE" ];then
>         PID=`sed -n 1p $PIDFILE`
>         if [ "$PID" -lt 0 ];then
>             PID=`expr 0 - $PID`
>             echo "$CMDNAME: Cannot restart postmaster.  postgres is
running (pid:
> $PID)" 1>&2
>             echo "Please terminate postgres and try again." 1>&2
>             exit 1
>         fi
>
>         kill "$sig" $PID
>
>         # wait for postmaster to shut down
>         if [ "$wait" = yes -o "$op" = restart ];then
>             cnt=0
>             $silence_echo $ECHO_N "waiting for postmaster to shut
down..."$ECHO_C
>
>             while :
>             do
>                 if [ -f "$PIDFILE" ];then
>                     $silence_echo $ECHO_N "."$ECHO_C
>                     cnt=`expr $cnt + 1`
>                     if [ "$cnt" -gt "$wait_seconds" ];then
>                         $silence_echo echo " failed"
>                         echo "$CMDNAME: postmaster does not shut down"
1>&2
>                         exit 1
>                     fi
>                 else
>                     break
>                 fi
>                 sleep 1
>             done
>             $silence_echo echo "done"
>         fi
>
>         if [ "$op" = "reload" ];then
>             $silence_echo echo "postmaster successfully signaled"
>         else
>             $silence_echo echo "postmaster successfully shut down"
>         fi
>
>     else # ! -f $PIDFILE
>         echo "$CMDNAME: cannot find $PIDFILE" 1>&2
>         echo "Is postmaster running?" 1>&2
>         if [ "$op" = "restart" ];then
>             echo "starting postmaster anyway" 1>&2
>         else
>             exit 1
>         fi
>     fi
> fi # stop, restart, reload
>
> if [ "$op" = "start" -o "$op" = "restart" ];then
>     oldpid=""
>     if [ -f "$PIDFILE" ];then
>         echo "$CMDNAME: Another postmaster may be running.  Trying to
start
> postmaster anyway." 1>&2
>         oldpid=`sed -n 1p $PIDFILE`
>     fi
>
>     # no -o given
>     if [ -z "$POSTOPTS" ];then
>         if [ "$op" = "start" ];then
>             # if we are in start mode, then look for
postmaster.opts.default
>             if [ -f "$DEFPOSTOPTS" ]; then
>                 eval set X "`cat $DEFPOSTOPTS`"; shift
>             fi
>         else
>             # if we are in restart mode, then look for postmaster.opts
>             eval set X "`cat $POSTOPTSFILE`"; shift
>             po_path="$1"
>             shift
>         fi
>     else # -o given
>         eval set X "$POSTOPTS"; shift
>     fi
>
>     if [ -n "$logfile" ]; then
>         "$po_path" ${1+"$@"} </dev/null >>$logfile 2>&1 &
>     else
>         # when starting without log file, redirect stderr to stdout, so
>         # pg_ctl can be invoked with >$logfile and still have pg_ctl's
>         # stderr on the terminal.
>         "$po_path" ${1+"$@"} </dev/null 2>&1 &
>     fi
>
>     # if had an old lockfile, check to see if we were able to start
>     if [ -n "$oldpid" ];then
>         sleep 1
>         if [ -f "$PIDFILE" ];then
>             if [ "`sed -n 1p $PIDFILE`" = "$oldpid" ];then
>                 echo "$CMDNAME: cannot start postmaster" 1>&2
>                 echo "Examine the log output." 1>&2
>                 exit 1
>             fi
>         fi
>     fi
>
>     # wait for postmaster to start
>     if [ "$wait" = yes ];then
>         cnt=0
>         $silence_echo $ECHO_N "waiting for postmaster to start..."$ECHO_C
>         while :
>         do
> # FIXME:  This is horribly misconceived.
> # 1) If password authentication is set up, the connection will fail.
> # 2) If a virtual host is set up, the connection may fail.
> # 3) If network traffic filters are set up tight enough, the connection
> #    may fail.
> # 4) When no Unix domain sockets are available, the connection will
> #    fail.  (Using TCP/IP by default ain't better.)
> # 5) When a different port is configured, the connection will fail
> #    or go to the wrong server.
> # 6) If the dynamic loader is not set up correctly (for this user/at
> #    this time), psql will fail (to find libpq).
> # 7) If psql is misconfigured, this may fail.
>             if "$PGPATH/psql" -l >/dev/null 2>&1
>             then
>                 break;
>             else
>                 $silence_echo $ECHO_N "."$ECHO_C
>                 cnt=`expr $cnt + 1`
>                 if [ "$cnt" -gt "$wait_seconds" ];then
>                     $silence_echo echo "failed"
>                     echo "$CMDNAME: postmaster does not start" 1>&2
>                     exit 1
>                 fi
>                 sleep 1
>             fi
>         done
>         $silence_echo echo "done"
>     fi
>     $silence_echo echo "postmaster successfully started"
> fi # start or restart
>
> exit 0
>
> __________________________________________________________________
> John Pagakis
> Email: john@pagakis.com
>
> Cheese -- Milk's leap towards immortality.
>        -- Clifton Fadiman
>
> 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: Wednesday, September 17, 2003 8:51 AM
> To: John Pagakis
> Cc: cygwin@cygwin.com
> Subject: 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/
>

--
				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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2003-09-17 17:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-16 20:18 Problem with stopping postmaster with pg_ctl John Pagakis
2003-09-16 20:53 ` Igor Pechtchanski
2003-09-16 21:12   ` John Pagakis
2003-09-16 21:53   ` John Pagakis
2003-09-16 22:00     ` Christopher Faylor
2003-09-17 15:28   ` John Pagakis
2003-09-17 15:50   ` John Pagakis
2003-09-17 16:18     ` Igor Pechtchanski
2003-09-17 16:40       ` John Pagakis
2003-09-17 17:09         ` Igor Pechtchanski
2003-09-17 17:43           ` John Pagakis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).