Re: Server tries to read a different config file than it is supposed to

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: rob stone <floriparob(at)gmail(dot)com>, twoflower <standa(dot)kurik(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Server tries to read a different config file than it is supposed to
Date: 2015-05-23 14:11:51
Message-ID: 55608AA7.2030309@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/23/2015 07:01 AM, rob stone wrote:
>
>
>
> On Sat, 2015-05-23 at 04:23 -0700, twoflower wrote:
>> I thought I understood how specifying a config file path for the
>> server works, but that's apparently not the case.
>>
>> The cluster data is at /storage/postgresql/9.4/data.
>>
>> The config files are at /etc/postgresql/9.4/main (this is the default
>> location on Ubuntu).
>>
>> This is how the beginning of /etc/postgresql/9.4/main/postgresql.conf
>> looks like:
>>
>> data_directory = '/storage/postgresql/9.4/data'
>> hba_file = '/etc/postgresql/9.4/main/pg_hba.conf'
>> ident_file = '/etc/postgresql/9.4/main/pg_ident.conf'
>>
>> So I wrote a few scripts to make my life easier, e.g. pg94start.sh:
>>
>> su postgres -c "/usr/lib/postgresql/9.4/bin/pg_ctl
>> -D /storage/postgresql/9.4/data -o '-c
>> config_file=/etc/postgresql/9.4/main/postgresql.conf'"
>>
>> But running this script did not work, the server would not start. So I
>> checked the log file and there was:
>>
>> FATAL: could not open file
>> "/storage/postgresql/9.4/data/postgresql.conf": Permission denied
>>
>> After fixing the ownership of this file, it worked.
>>
>> What's the reason the server was trying to access that file? Why does
>> not the override given by the config_file parameter work?
>>
>> Thank you.
>>
>> ______________________________________________________________________
>> View this message in context: Server tries to read a different config
>> file than it is supposed to
>> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>
>
> Similar hassles with Debian. I use scripts like this to start the
> server.
>
> #! /bin/sh
> PGDATA=/home/postgres/data94;export PGDATA
> PATH=$PATH:/usr/lib/postgresql/9.4/bin;export PATH
> PGBINARIES=/usr/lib/postgresql/9.4/bin;export PGBINARIES
> cd /usr/lib/postgresql/9.4/bin
> ./pg_ctl start
> exit 0
>
> I have different scripts depending on the version of Postgres that I
> need. I know that I could have a generic script and just pass in the
> variables. I run them as the postgres user.
> It reads the conf file from the PGDATA path.

Any particular reason you do not use pg_ctlcluster?:

https://wiki.debian.org/PostgreSql#pg_ctl_replacement

>
> HTH.
>
> Robert
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2015-05-23 15:06:45 Re: Server tries to read a different config file than it is supposed to
Previous Message Adrian Klaver 2015-05-23 14:01:43 Re: Server tries to read a different config file than it is supposed to