David Christensen wrote:
> Enclosed is a patch to add a -C option to initdb to allow you to easily append configuration directives to the
generatedpostgresql.conf file for use in programmatic generation.
We had a patch not quite make it for 9.0 that switched over the
postgresql.conf file to make it easy to scan a whole directory looking
for configuration files:
http://archives.postgresql.org/message-id/9837222c0910240641p7d75e2a4u2cfa6c1b5e603d84@mail.gmail.com
The idea there was to eventually reduce the amount of postgresql.conf
hacking that initdb and other tools have to do. Your patch would add
more code into a path that I'd like to see reduced significantly.
That implementation would make something easy enough for your use case
too (below untested but show the general idea):
$ for cluster in 1 2 3 4 5 6; do initdb -D data$cluster ( cat <<EOF
port = 1234$cluster;
max_connections = 10;
shared_buffers=1M;
EOF ) > data$cluster/conf.d/99clustersetup
done
This would actually work just fine for what you're doing right now if
you used ">> data$cluster/postgresql.conf" for that next to last line
there. There would be duplicates, which I'm guessing is what you wanted
to avoid with this patch, but the later values set for the parameters
added to the end would win and be the active ones.
--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg@2ndQuadrant.com www.2ndQuadrant.us