Wouldn't it be nice of postmaster recorded it's pid

From: Karl DeBisschop <kdebisschop(at)range(dot)infoplease(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Wouldn't it be nice of postmaster recorded it's pid
Date: 2000-01-07 16:50:00
Message-ID: 200001071650.LAA22693@skillet.infoplease.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)(dot)*(at)\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(at)alert(dot)infoplease(dot)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

Browse pgsql-general by date

  From Date Subject
Next Message ^chewie 2000-01-07 19:26:45 Re: [GENERAL] Re: MySQL / PostgreSQL (was: Postgres object orientation)
Previous Message WalterChristler 2000-01-07 16:39:17 .,.IF AOL WAS A CAR..,,