Re: postmaster: init.d/start - Mailing list pgsql-sql

From Daniel Fairs
Subject Re: postmaster: init.d/start
Date
Msg-id Pine.LNX.4.10.10006101328550.12733-100000@bits.bris.ac.uk
Whole thread Raw
In response to postmaster: init.d/start  (Markus Wagner <mawagner@mail.uni-mainz.de>)
List pgsql-sql
This is the System V-style initialisation. The layout is as follows:

/etc/rc.d/init.d/
This directory contains the actual scripts which start and stop the
various services on the system. The system supplies a 'start' or 'stop'
parameter for the call of the script depending on whether the system is
starting up (or changing runlevel) or shutting down.

/etc/rc.d/rcX.d
As you say, these correspond to each of the runlevels. Each of these
directories contains symbolic links to the scripts in ../init.d
corresponding to the services to be started or stopped in that runlevel.
Links to services to be started in that runlevel start with S and those to
be stopped (killed) start with K. Then there is a number, so the system
knows what order to start the services in (eg. networking needs to be
brought up before name services can start).

As to which runlevel you should start the postmaster in, well, you'll
probably want to start it in the runlevel(s) corresponding to full
multiuser mode, and multisuer mode with X (if applicable). On my RedHat
system, these are runlevels 3 and 5. I think they're different on a SuSE
system, 2 and 3 from memory. Check your /etc/inittab for details, it'll
tell you which runlevel corresponds to what mode of use.

So, to conclude: you need a script called (for example) postgresql int
your /etc/rc.d/init.d directory. This will start and stop the postmaster,
and should be written to expect 'start' or 'stop' as parameters. Take a
look at (for example) the /etc/rc.d/init.d/apache startup script for a
'template' of how to do this. Obviously you'll need the commands to
start/stop the postmaster rather than apache when building this script ;).

Secondly, you'll have to decide which runlevels you want the postmaster to
start in (probably 2 and 3, I may be wrong). Then create a link in the
rcX.d directories corresponding to those runlevels up to the startup
script for starting the postmaster, and shutting it down when the runlevel
changes. For example:

cd /etc/rc.d/init.d
pico postgresql
<write a script, test it works>
cd ../rc3.d
ln -s ../postgresql S60postgresql
ln -s ../postgresql K60postgresql

... and so on for other runlevels. You might want to put a kill link in
the runlevel directory used for system shutdown (6 on my system) so
postmaster gets shut down properly.

As far as at what point you should start the postmaster, you should start
it after the services that it depends on have started, so probably after
networking and maybe named, if you run it. I find that around 60-ish works
well.

Hope this helps,
Dan

On Sat, 10 Jun 2000, Markus Wagner wrote:

> Hi,
> 
> under SuSe Linux 6.3 there are different subdirectories rc<X>.d for
> different runlevels. Each dir contains links to the start/stop scripts.
> The filenames contain numbers to indicate the position / the order of
> the services to start.
> 
> Where (for which runlevel) and at what position should I link the pg
> start/stop script?
> Why should one link it for more than one runlevel (I noticed this for
> apache)?
> 
> Thanks,
> 
> Markus
> 
> 


Daniel Fairs
danfairs@bits.bris.ac.uk, danfairs@hotmail.com
http://www.darkalley.co.uk, http://listen.to/agentorange

Just because you're not paranoid doesn't mean they're not out to get you.





pgsql-sql by date:

Previous
From: GANESH KUMAR
Date:
Subject: BACK UP
Next
From: "Poul L. Christiansen"
Date:
Subject: Re: BACK UP