Skip site navigation (1) Skip section navigation (2)

Re: postmaster: init.d/start

From: Daniel Fairs <danfairs(at)bits(dot)bris(dot)ac(dot)uk>
To: markus(dot)wagner(at)bigfoot(dot)com
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: postmaster: init.d/start
Date: 2000-06-10 12:43:29
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
This is the System V-style initialisation. The layout is as follows:

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.

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

Hope this helps,

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(at)bits(dot)bris(dot)ac(dot)uk, danfairs(at)hotmail(dot)com,

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

In response to


pgsql-sql by date

Next:From: Jean-Marc LibsDate: 2000-06-10 17:28:22
Subject: SERIAL type does not generate new ID ?
Previous:From: Poul L. ChristiansenDate: 2000-06-10 12:29:22
Subject: Re: BACK UP

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group