Thread: Running Postmaster - PGDATA Variable

Running Postmaster - PGDATA Variable

From
Mike C
Date:
Hi,

>You must specify the directory that contains the database system either by specifying the -D >invocation option or by
settingthe PGDATA environment variable. 

Where can I set this variable so I don't get this message all the time. I did type

[localhost:/usr/local] postgres% postmaster -D /usr/local/pgsql/data but got this message:
Lock file "/usr/local/pgsql/data/postmaster.pid" already exists.
--

Regards
Mike C


Re: Running Postmaster - PGDATA Variable

From
missive@frontiernet.net (Lee Harr)
Date:
On Thu, 26 Jul 2001 23:47:34 +0000 (UTC), Mike C <mike@stonebow.otago.ac.nz>:
> Hi,
>
>>You must specify the directory that contains the database system either by specifying the -D >invocation option or by
settingthe PGDATA environment variable. 
>
> Where can I set this variable so I don't get this message all the time. I did type
>
> [localhost:/usr/local] postgres% postmaster -D /usr/local/pgsql/data but got this message:
> Lock file "/usr/local/pgsql/data/postmaster.pid" already exists.
> --


You would set the PGDATA variable in your shell initialization file
(might be .cshrc or .profile for instance) see the documentation for
your shell on how to set the variable.

If you are absolutely sure that there is not another postmaster
still running you can remove the postmaster.pid file

The file may have been left there if you killed the postmaster
without shutting down properly (like if the power went out on
your computer.)



Re: Re: Running Postmaster - PGDATA Variable

From
Martijn van Oosterhout
Date:
On Fri, Jul 27, 2001 at 12:28:25AM +0000, Lee Harr wrote:
> > Lock file "/usr/local/pgsql/data/postmaster.pid" already exists.

> If you are absolutely sure that there is not another postmaster
> still running you can remove the postmaster.pid file
>
> The file may have been left there if you killed the postmaster
> without shutting down properly (like if the power went out on
> your computer.)

Can't postgres check to see if the pid listed in that file is still active?
If it is then you can say so, if not then (unless the data is shared out and
there's a postmaster running elsewhere) it's fine to delete it.

--
Martijn van Oosterhout <kleptog@svana.org>
http://svana.org/kleptog/
> It would be nice if someone came up with a certification system that
> actually separated those who can barely regurgitate what they crammed over
> the last few weeks from those who command secret ninja networking powers.

Re: Re: Running Postmaster - PGDATA Variable

From
Tom Lane
Date:
Martijn van Oosterhout <kleptog@svana.org> writes:
> Can't postgres check to see if the pid listed in that file is still active?

It does, at least in recent releases ...

            regards, tom lane