Re: Finding the bin path - Mailing list pgsql-general

From John R Pierce
Subject Re: Finding the bin path
Date
Msg-id 4B37F93A.6040709@hogranch.com
Whole thread Raw
In response to Re: Finding the bin path  (Rob Jaeger <yogirob@gmail.com>)
List pgsql-general
Rob Jaeger wrote:
> I was not clear in my initial question. I need to access the
> pg_dump.exe and pg_restore.exe files from within a c++ program. I
> can't execute pg_config.exe because it's in that bin that I'm seeking.
>
> I don't quite follow Greg Smith's reply of 'try guess based on "which
> postmaster"' (can you clarify?)
>

    $ which postmaster
    /usr/bin/postmaster


the which command on most unix platforms searches the PATH

> But - I think I have found what I need! I can do a "SHOW
> data_directory;" and then from there I can snoop inside the
> postmaster.opts file to get the bin path. The question I have now is -
> is this method safe? Is this file present in all platform data
> directories. (I'm using Win7)

its there on a RHEL/CentOS/Fedora default install...

    $ more $PGDATA/postmaster.opts
    /usr/bin/postgres "-p" "5432" "-D" "/var/lib/pgsql/data"


the one I'd be worried about would be a debian/ubuntu install as they
move stuff around all over the place and can support several concurrent
installations.



pgsql-general by date:

Previous
From: Rob Jaeger
Date:
Subject: Re: Finding the bin path
Next
From: Craig Ringer
Date:
Subject: Re: Finding the bin path