starting PGSQL automatically on Redhat 6.2

Started by Ryan Mahoneyover 25 years ago6 messagesgeneral
Jump to latest
#1Ryan Mahoney
ryan@paymentalliance.net

Hey all, I copied the pg_ctl script and placed it in my /etc/rc.d/init.d/
directory and renamed it 'postgres'. I then made all the necessary symbolic
links. When my machine boots up however, pgsql does not start up because it
cannot be started by root. I have created the 'postgres' user and data
directories. I can start PG manually just fine. Can someone post or mail a
working startup script/recommend any changes to pg_ctl? Thanks!

Ryan Mahoney
ryan@paymentalliance.net

#2T F
torford@hotmail.nospam.com
In reply to: Ryan Mahoney (#1)
Re: starting PGSQL automatically on Redhat 6.2

Ryan Mahoney wrote:

Hey all, I copied the pg_ctl script and placed it in my /etc/rc.d/init.d/
directory and renamed it 'postgres'. I then made all the necessary symbolic
links. When my machine boots up however, pgsql does not start up because it
cannot be started by root. I have created the 'postgres' user and data
directories. I can start PG manually just fine. Can someone post or mail a
working startup script/recommend any changes to pg_ctl? Thanks!

Ryan Mahoney
ryan@paymentalliance.net

You might try this, it was taken from the postgresql-6.5.3-6 rpm:

Attachments:

postgresqltext/plain; charset=us-ascii; name=postgresqlDownload
#3Brett W. McCoy
bmccoy@chapelperilous.net
In reply to: Ryan Mahoney (#1)
Re: starting PGSQL automatically on Redhat 6.2

On Tue, 9 Jan 2001, Ryan Mahoney wrote:

Hey all, I copied the pg_ctl script and placed it in my /etc/rc.d/init.d/
directory and renamed it 'postgres'. I then made all the necessary symbolic
links. When my machine boots up however, pgsql does not start up because it
cannot be started by root. I have created the 'postgres' user and data
directories. I can start PG manually just fine. Can someone post or mail a
working startup script/recommend any changes to pg_ctl? Thanks!

You need to su to the postgres user in your script to start the
postmaster:

su postgres -c "postmaster -i ... "

There's a complete example in the installation docs.

-- Brett
http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
History is the version of past events that people have decided to agree on.
-- Napoleon Bonaparte, "Maxims"

#4Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: T F (#2)
Re: Re: starting PGSQL automatically on Redhat 6.2

From: T F <torford@hotmail.nospam.com>
Subject: [GENERAL] Re: starting PGSQL automatically on Redhat 6.2
Date: Tue, 09 Jan 2001 12:12:52 -0700
Message-ID: <3A5B62B4.C73124BE@hotmail.nospam.com>

Ryan Mahoney wrote:

Hey all, I copied the pg_ctl script and placed it in my /etc/rc.d/init.d/
directory and renamed it 'postgres'. I then made all the necessary symbolic
links. When my machine boots up however, pgsql does not start up because it
cannot be started by root. I have created the 'postgres' user and data
directories. I can start PG manually just fine. Can someone post or mail a
working startup script/recommend any changes to pg_ctl? Thanks!

Ryan Mahoney
ryan@paymentalliance.net

You might try this, it was taken from the postgresql-6.5.3-6 rpm:

That script seems dangerous. It calls

killproc postmaster

to terminate postmaster. In this case killproc firstly sends SIGTERM
to postmaster (this is ok). But if postmaster won't die with the
signal, then killproc sends SIGKILL to postmaster (this is not
good). SIGINT or SIGQUIT should be sent in this case.

BTW, pg_ctl only works with version 7.0 or higher.
--
Tatsuo Ishii

#5Ryan Mahoney
ryan@paymentalliance.net
In reply to: Tatsuo Ishii (#4)
Re: Re: starting PGSQL automatically on Redhat 6.2

I'm actaully trying to get 7.1b to start automatically, still no success,
but I'm making progres.

Trying to modify the pg_ctl that comes with 7.1 to add the su - postgres -c
....

-Ryan

Tatsuo Ishii wrote in message <20010110111111X.t-ishii@sra.co.jp>...

From: T F <torford@hotmail.nospam.com>
Subject: [GENERAL] Re: starting PGSQL automatically on Redhat 6.2
Date: Tue, 09 Jan 2001 12:12:52 -0700
Message-ID: <3A5B62B4.C73124BE@hotmail.nospam.com>

Ryan Mahoney wrote:

Hey all, I copied the pg_ctl script and placed it in my

/etc/rc.d/init.d/

directory and renamed it 'postgres'. I then made all the necessary

symbolic

links. When my machine boots up however, pgsql does not start up

because it

cannot be started by root. I have created the 'postgres' user and data
directories. I can start PG manually just fine. Can someone post or

mail a

Show quoted text

working startup script/recommend any changes to pg_ctl? Thanks!

Ryan Mahoney
ryan@paymentalliance.net

You might try this, it was taken from the postgresql-6.5.3-6 rpm:

That script seems dangerous. It calls

killproc postmaster

to terminate postmaster. In this case killproc firstly sends SIGTERM
to postmaster (this is ok). But if postmaster won't die with the
signal, then killproc sends SIGKILL to postmaster (this is not
good). SIGINT or SIGQUIT should be sent in this case.

BTW, pg_ctl only works with version 7.0 or higher.
--
Tatsuo Ishii

#6Mike Castle
dalgoda@ix.netcom.com
In reply to: Ryan Mahoney (#5)
Re: Re: starting PGSQL automatically on Redhat 6.2

On Wed, Jan 10, 2001 at 12:17:23PM -0000, Ryan Mahoney wrote:

I'm actaully trying to get 7.1b to start automatically, still no success,
but I'm making progres.

Trying to modify the pg_ctl that comes with 7.1 to add the su - postgres -c

I added the following to the postgres account's .profile:

export PGDATA=${HOME}/data

I then had to use the following in my startup script:

su - postgres -- --login -c "pg_ctl -o -S start"

su - postgres -- --login -c "pg_ctl stop"

The reason for the --login is that the bash/gnu-su combination is broken (IMO)
wrt to sourcing .profile when ran from su.

mrc
--
Mike Castle Life is like a clock: You can work constantly
dalgoda@ix.netcom.com and be right all the time, or not work at all
www.netcom.com/~dalgoda/ and be right at least twice a day. -- mrc
We are all of us living in the shadow of Manhattan. -- Watchmen