John wrote:
On Fri, 13 Dec 2002, Michael wrote:
Hi all,
I have a perplexing problem . I want to start postgresql In %post
section of Kickstart, so I can connect to template1 as postgres user,
add new DB users, and initialise a database (All in ks.cfg). I would
also like to be able to initialise a DB from a schema once the user is
created
I have done this in ks.cfg :
%post --interpreter /bin/bash
/sbin/service postgresql start
/bin/echo "CREATE USER admin WITH PASSWORD 'somepassword' CREATEDB
CREATEUSER;"| /usr/bin/psql -d template1 -U postgres
However, the user is never created. I have done this:
/sbin/service postgresql start 2>&1 >/tmp/startPGresult
Just to see the result returned from the command. /tmp/startPGresult
contains:
Initializing database: ESC[60G[ ESC[0;32mOKESC[0;39m ]
Starting postgresql service: ESC[60G[ESC[0;31mFAILEDESC[0;39m]
Wonderful!! Absolutely Wonderful!!!!
Take a look at the /etc/rc.d/init.d/postgresql
See all the '>dev/null's? (I'm assuming they're still there!).
They are...
Take them out.
Red Hat believes people don't need the error messages postgresql
produces and sends them off to the bit-bucket.
Hmm so this breaks the start script when run from kicksart %post ??
I had a debate about this with the RHL person some time ago, and he
wasn't receptive to the idea of fixing it, so I'm supposing (without
checking) that it's not fixed.
Feel free to BZ the problem and bitch and whinge about it.
Yes, shall.
Thanks for the tip. (Grumbling about 2 days playing with said ks.cfg
trying all sorts of things)
BTW, I have managed a work around of sorts. I created a rc.local
during %post to run on first boot, initialise the new DB users, and
restore DB schema. The rc.local them re-writes itself to be empty
again (Apart from subsys lock). It worked.
Cheers,
Michael