Re: Finding the bin path

From: John R Pierce <pierce(at)hogranch(dot)com>
To: Rob Jaeger <yogirob(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Finding the bin path
Date: 2009-12-28 00:18:02
Message-ID: 4B37F93A.6040709@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2009-12-28 00:25:54 Re: Finding the bin path
Previous Message Thomas Kellerer 2009-12-27 14:17:51 Re: Get Comments on Tables / Functions