X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2EBB84765CF for ; Thu, 8 May 2003 14:36:24 -0400 (EDT) Received: from pop015.verizon.net (pop015pub.verizon.net [206.46.170.172]) by postgresql.org (Postfix) with ESMTP id 5DB2D4765C1 for ; Thu, 8 May 2003 14:36:23 -0400 (EDT) Received: from RavChaim ([162.84.129.6]) by pop015.verizon.net (InterMail vM.5.01.05.33 201-253-122-126-133-20030313) with ESMTP id <20030508183623.XRXJ17297.pop015.verizon.net@RavChaim>; Thu, 8 May 2003 13:36:23 -0500 Content-Type: text/plain; charset="iso-8859-1" From: mlaks To: pgsql-admin@postgresql.org Subject: Re: Postgresql goes down need to restart (redhat postgresql service script) lock files removal avoid 2 postmasters Date: Thu, 8 May 2003 14:10:52 -0400 User-Agent: KMail/1.4.1 References: <200305081250.49994.mlaks@bellatlantic.net> <20030508175021.GA3335@wolff.to> In-Reply-To: <20030508175021.GA3335@wolff.to> Cc: Bruno Wolff III MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200305081410.52791.mlaks@bellatlantic.net> X-Authentication-Info: Submitted using SMTP AUTH at pop015.verizon.net from [162.84.129.6] at Thu, 8 May 2003 13:36:23 -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/96 X-Sequence-Number: 8658 Thank you for your response Bruno. I agree about the importance of using th= e=20 lines #!/bin/sh exec 2>&1 exec setuidgid postgres /usr/local/pgsql/bin/postmaster -D=20 /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 wi= th=20 the following: 1.=20 I notice that Lamar's postgresql service script removes "stale lock files"= =20 before starting postgresql by using the line rm -f /tmp/.s.PGSQL.* > /dev/null and perhaps my own experience indicates we also should add a line=20 rm -f /var/lib/pgsql/data/postmaster.pid=20 because sometimes when my machine crashes and gets rebooted I must manually= =20 remove that file. 2. Moreover, I see that after successfully starting postgresql Lamar touches = a=20 file touch /var/lock/subsys/postgresql and does this echo $pid > /var/run/postmaster.pid so how can we do that? 3.=20 I can imagine we can accomplish 1. with #!/bin/sh rm -f /tmp/.s.PGSQL.* > /dev/null rm -f /var/lib/pgsql/data/postmaster.pid=20 exec 2>&1 exec setuidgid postgres /usr/local/pgsql/bin/postmaster -D=20 /usr/local/pgsql/data but how do we do 2. -> the touching and echoing after the process starts if= we=20 have replaced the "run" process by the postmaster process with the exec so= =20 that the daemontools "svc" can control the process? Mitchell On Thursday 08 May 2003 01:50 pm, you wrote: > On Thu, May 08, 2003 at 12:50:49 -0400, > > mlaks wrote: > > My goal is to use DJ Bernsteins daemonstools to make sure that my > > Postgresql process goes back up unattended if it goes down for some > > reason. So I will be substituting daemontools for the postgresql service > > script. > > Thus I want to know what lock files to remove to make sure all is ok. I > > also want to follow Tom Lanes's advice and not shoot myself in the foot > > by creating two different postmaster processes working the same > > database!!!! > > This is what I put in my run file: > #!/bin/sh > exec 2>&1 > exec setuidgid postgres /usr/local/pgsql/bin/postmaster -D > /usr/local/pgsql/data > > I use multilog for logging as you normally would.