Обсуждение: postmaster: init.d/start

Поиск
Список
Период
Сортировка

postmaster: init.d/start

От
Markus Wagner
Дата:
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



Re: postmaster: init.d/start

От
Daniel Fairs
Дата:
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.





Re: postmaster: init.d/start

От
Markus Wagner
Дата:
Hi Daniel,

thank you for your reply.

There are some unanswered questions.
Why does one have to consider multiple run levels? Doesn't run level 3
(network + X) implicate run level 2 (network)?
So if I don't use XDM (or equivalent) and the system starts with a login
shell only, it would start run level 2 services. And if I use XDM and
the system starts using X it would also load run level 2 services?

Markus

Daniel Fairs wrote:
> 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.
> 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




Re: postmaster: init.d/start

От
Bill Anderson
Дата:
Markus Wagner wrote:
> 
> Hi Daniel,
> 
> thank you for your reply.
> 
> There are some unanswered questions.
> Why does one have to consider multiple run levels? Doesn't run level 3
> (network + X) implicate run level 2 (network)?
> So if I don't use XDM (or equivalent) and the system starts with a login
> shell only, it would start run level 2 services. And if I use XDM and
> the system starts using X it would also load run level 2 services?


Not neccesarily. each run-level contains it's own list of services. They
may, or may not, overlap.

BTW, Runlevel3 is generally networking + NFS, NOT X. X is usually
runlevel 5 (all depending on the variant). if you start a system not
configured to go to X-RUnlevel, it will usually go to runlevel 3 (Don't
recall ever seeing a default system go to runlevel two; Unix/Linux).


Re: postmaster: init.d/start

От
Thomas Mack
Дата:
>Hi Daniel,
>
>thank you for your reply.
>
>There are some unanswered questions.
>Why does one have to consider multiple run levels? Doesn't run level 3
>(network + X) implicate run level 2 (network)?

Not on SuSE Linux. On SOlaris for example, you will find in /etc/inittab
an entry like:

s2:23:wait:/sbin/rc2

with the meaning that /sbin/rc2 will be executed in runlevel 2 AND 3 as
well. So all the scripts in rc2.d will be started in runlevel 3 as well
(on Solaris).

In SuSE you find:

l2:2:wait:/sbin/init.d/rc 2
l3:3:wait:/sbin/init.d/rc 3

So each runlevel just starts its scripts only.

>So if I don't use XDM (or equivalent) and the system starts with a login
>shell only, it would start run level 2 services. And if I use XDM and
>the system starts using X it would also load run level 2 services?
>
No, not on SuSE. But you can change your /etc/inittab, if you like to have
this behaviour. Actually, you will find (almost?) all scripts from
/sbin/init.d/rc2.d doubled in /sbin/init.d/rc3.d for the reason, that
runlevel 3 does NOT start the scripts for runlevel 2.


Thomas Mack
TU Braunschweig, Abt. Informationssysteme