X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 1B849474E4F for ; Thu, 8 May 2003 15:04:41 -0400 (EDT) Received: from out005.verizon.net (out005pub.verizon.net [206.46.170.143]) by postgresql.org (Postfix) with ESMTP id 960A9476624 for ; Thu, 8 May 2003 15:04:39 -0400 (EDT) Received: from RavChaim ([162.84.129.6]) by out005.verizon.net (InterMail vM.5.01.05.33 201-253-122-126-133-20030313) with ESMTP id <20030508190440.DXAW25152.out005.verizon.net@RavChaim>; Thu, 8 May 2003 14:04:40 -0500 Content-Type: text/plain; charset="iso-8859-1" From: mlaks To: Bruno Wolff III Subject: Re: Postgresql goes down need to restart (redhat postgresql service script) lock files removal avoid 2 postmasters Date: Thu, 8 May 2003 14:39:08 -0400 User-Agent: KMail/1.4.1 References: <200305081250.49994.mlaks@bellatlantic.net> <200305081410.52791.mlaks@bellatlantic.net> <20030508184033.GA3731@wolff.to> In-Reply-To: <20030508184033.GA3731@wolff.to> Cc: pgsql-admin@postgresql.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200305081439.08973.mlaks@bellatlantic.net> X-Authentication-Info: Submitted using SMTP AUTH at out005.verizon.net from [162.84.129.6] at Thu, 8 May 2003 14:04:39 -0500 X-Spam-Status: No, hits=-38.4 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, RCVD_IN_OSIRUSOFT_COM,REFERENCES,REPLY_WITH_QUOTES, USER_AGENT_KMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/98 X-Sequence-Number: 8660 Bruno, Thanks for your help. I was wondering: Should we in fact be execing the postmaster as you describe or perhaps pg_c= tl=20 as Lamar's script uses or perhaps a "new" script that incorporates pg_ctl or postmaster and a signal catching= =20 mechanism. The reason I ask is that=20 the way that daemontools stops a service - if you want it to - is via the= =20 command svc opts postgresl :=20 with opts -d: Down. If the service is running, send it a TERM signal and then a CONT= =20 signal. After it stops, do not restart it.=20 -o: Once. If the service is not running, start it. Do not restart it if it= =20 stops.=20 -p: Pause. Send the service a STOP signal.=20 -c: Continue. Send the service a CONT signal.=20 -h: Hangup. Send the service a HUP signal.=20 -a: Alarm. Send the service an ALRM signal.=20 -i: Interrupt. Send the service an INT signal.=20 -t: Terminate. Send the service a TERM signal.=20 -k: Kill. Send the service a KILL signal.=20 now we would not want to kill the postmaster, of course. But should we even= be=20 TERM'ing the postmaster? I dont know. What do the Postgresql Gurus say?=20 Moreover, if we agree that we need to imbed pg_ctl or postmaster in a scrip= t=20 to handle the above things, it should be doable to handle all of the assort= ed=20 other files if they are neccesary to handle . Do you agree? Also what would be the problem in checking for the existence of a postmaste= r=20 and if none exists then killing the lock files.=20 My main problem is that I have machines that get creamed by power surges, a= nd=20 then wont restart postgresql on reboot of the system because of the damn lo= ck=20 files. I really want to deal with them up front!=20 MOreover can you tell me more about what init uses the locks for? what is the role of the files /var/run/postmaster.pid /var/lock/subsys/postgresql that Lamar carefully adds and subtracts? rm -f /var/run/postmaster.pid rm -f /var/lock/subsys/postgresql Thanks Mitchell=20 On Thursday 08 May 2003 02:40 pm, you wrote: > On Thu, May 08, 2003 at 14:10:52 -0400, > > mlaks wrote: > > Thank you for your response Bruno. I agree about the importance of using > > the lines > > > > #!/bin/sh > > exec 2>&1 > > exec setuidgid postgres /usr/local/pgsql/bin/postmaster -D > > /usr/local/pgsql/data > > > > in the run file. However, what else must we put in as well? > > > > My question is to understand the lock files for postgresql so I can deal > > with the following: > > Some of the lock files have to do with the init system. Those can be > ignored. Postgres also keeps a lock file and that is used to prevent > two postmasters from running at the same time. You probably don't want > to have a script remove that lock file, because if there really is > another postmaster running, starting a second one can be a disaster. > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)