Re: postmaster -S will not print an error if pid file exists

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: postmaster -S will not print an error if pid file exists
Date: 2001-01-26 23:22:59
Message-ID: 13060.980551379@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> If a second postmaster is started on a data directory and the second one
> uses the -S option it will not print a message but simply exit and not
> start a background process. The exit status is 0.

On closer inspection, it's clear that the postmaster *does* exit with
status 1 after failing to lock the lockfile. However, since it's
already forked and detached from the terminal, you can't see the status
1; the parent process exited with status 0. Postponing the fork till
after we grab the lockfile will not do, because then the lockfile will
contain the wrong postmaster PID.

I have stated before that I consider -S evil. Don't complain too hard
about its behavior, or I'll fix it by ripping it out, lock stock and
barrel ;-)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Mikheev, Vadim 2001-01-26 23:34:46 RE: Permissions on CHECKPOINT
Previous Message Bruce Momjian 2001-01-26 23:17:28 Re: Permissions on CHECKPOINT