Wouldn't it be nice of postmaster recorded it's pid - Mailing list pgsql-general

From Karl DeBisschop
Subject Wouldn't it be nice of postmaster recorded it's pid
Date
Msg-id 200001071650.LAA22693@skillet.infoplease.com
Whole thread Raw
List pgsql-general
I'm running redhat linux.  Redhat provides a set of init script
functions that try various means to find the pid of the just invoked
program on startup.  Problem is these all fail if you are trying to
run two postmasters.

Now it's true that this can be fixed by more complex greps. Actually,
I just gave in and wrote a perl oneliner - here it is if anyone cares:

newpidof() {
  ps axw | perl -ne "print if s@ *([0-9]+) .*? [0-9]+:[0-9]+ ($1).*@\1@;"
}

Then instead of pidof immediately after starting the postmaster, the
init script calls newpidof and writes that to the /var/run/???.pid file.

But, after all this messing around, it would be alot easier if
postmaster would have an option to write a lock file itself when
daemonizing.  Then you could invoke as, say:

/usr/bin/postmaster -L /var/run/postmaster2.pid

and count on being able to read the pid from the resulting file.

I've written this code for another open source app - it's
straightforward (must be if I can do it).  So my questions are:

1) Would this be of some general use to others?

2) Are there reasons not to provide something like this?

3) Would it help if I wrote such a thing to drop into postgres or is
   it so dead simple that one of the developers could more easily do
   it on a routine pass through the code?

--
Karl DeBisschop <kdebisschop@alert.infoplease.com>
617.832.0332 (Fax: 617.956.2696)

Information Please - your source for FREE online reference
http://www.infoplease.com  - Your Ultimate Fact Finder
http://kids.infoplease.com - The Great Homework Helper

Netsaint Plugins Development
http://netsaintplug.sourceforge.net

pgsql-general by date:

Previous
From: Michael J Davis
Date:
Subject: RE: [GENERAL] Benchmarks
Next
From: WalterChristler@gvukvjq.edu.tht.net
Date:
Subject: .,.IF AOL WAS A CAR..,,