🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.linux
Article #57514

Re: HOW: RedHat 3.0.3 - Setting up network stuff

#57514
From: David Nugent
Date: Wed, 25 Sep 1996 00:00
149 lines
6358 bytes
On Fri, 20 Sep 1996 13:46:28 GMT,
  C. Scott Sheffield <scott@surfsouth.com> wrote:

>> /etc/sysconfig/network-scripts/ifcfg-eth0 and ifup-eth.  
>
>I am trying to figure out the same problem.
>also, where would i put the commands to start named?
>all the books i have refer to rc.inet1 and rc.inet2.
>Is there some type of cross reference available?

RedHat uses a "sysv" scheme rather than the simplistic
approach Slackware have taken, with only a few chained rc
files.

The scheme works thus:

- /etc/rc.d/rc is invoked, irrespective of whether the system is
  starting up, shutting down, transiting between runlevels or
  just about anything else. The runlevel itself (to which the
  system is being "moved") is passed on the command line.

- This 'rc' script decides what it is doing (just booting, moving
  between runlevels, or shutting down), and invokes a number of
  initialisation files (which comprise the rcN.d subdirectories
  under /etc/rc.d) either with a "stop" argument (which ends a
  runlevel) or a "start" argument (which starts a runlevel).

- Which commands are run, depends entirely on the contents of the
  runlevel directories. Any commands (which are purely links to
  the *real* scripts in /etc/rc.d/init.d) commencing with "K"
  are run when the runlevel is shutdown, and any commencing with
  "S" are run when the runlevel is starting up.

- A "lock" file is create to preven thigns from being started up
  twice without having to do a shutdown/startup between any
  given transition.

- The order in which these commands are run is alphabetic, since
  the directory itself is scanned using /bin/ls.

Now, what does all this mean? It means that the system is
more complex (internally), but MAINTENANCE is a lot easier.
By renaming files in the separate subdirectories, creating or
removing links, you can control what is run when, and in
which order, during startup and shutdown of the system,
without even needing to edit a script - just by using rm, ln -s.

Most of the init scripts in /etc/rc.d/init.d have a fairly
standard forumla. Mostly, you can copy these to a new one,
modify slightly, then create the links as appropriate. In the
case of a nameserver, you'll probably want to set that up
fairly early in the piece, but AFTER you've initialised the
network interface itself (of course :-)). Otherwise, anything
that references a symbolic link either on the command line or
in one of its config files is going to hang, unless the
nameserver is already running.

FWIW, I'll include the /etc/rc.d/init.d/named flie I use:

 -- cut --
#!/bin/sh
#
# named  This shell script takes care of starting and
#        stopping named, the name server daemon
#

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/named ] || exit 0

[ -f /etc/named.boot ] || exit 0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting named: "
        daemon named
        echo
        touch /var/lock/subsys/named
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down named: "
        killproc named
        echo "done"
        rm -f /var/lock/subsys/named
        ;;
  *)
        echo "Usage: named {start|stop}"
        exit 1
esac

exit 0
 -- cut --

As you can see, it is a fairly standard formula and pretty
much matches most of the other scripts in there. Only a check
for the executable and /etc/named.boot are done (both of
which are required in order to start or stop it, obviously).

Now, I created symbolic links "S20named" and "K80named" in
the runlevel subdirectories. Now *which* subdirectories are
linked depends on what you're using your runlevels for. Our
'standard' runlevel is runlevel 3, so there's a "S20named" in
there linked to ../init.d/named (none in runlevel 2 or 1,
both of which are maintenance-only runlevels, and only the
network interface is started in 2 with no other daemons).

Runlevel 6 and 0 are "halt the system" runlevels, so you'll
need to at least create links in there starting with "K".
You'll also want to take it down LAST, or pretty close to
last, so name it up high (which is why I use K80named). In
general, you'll take down servers in the reverse order in
which they've been invoked, but with non-critical services it
probably won't matter much.

Anyway, I hope this helps clarify things a little. On a
historical note, this approach was fairly common with SysV
R3.x systems (even without symbolic links), but really hit
the forefront with Solaris where it became quite fashionable
and adopted with gusto by SVR4 systems. To take down or put up
services, the installation and maintenance scripts would just
remove or create symbolic links to their rc scripts and not
have to worry about telling folks to edit this or that and
hope to hell they get it right. :) I guess redhat felt the
same way.

Personally, I prefer a simpler /etc/rc.* approach (a la BSD)
without all the runlevel nonsense, but then again, I'm also
familiar and comfortable with scripts, so YMMV.


Regards,
David


-- 
David Nugent, Unique Computing Pty Ltd - Melbourne, Australia
Voice +61-3-791-9547 Data/BBS +61-3-792-3507 3:632/348@fidonet
davidn@blaze.net.au http://www.blaze.net.au/~davidn
Technical Details
Message-ID: <slrn54juhu.g05.davidn@sdev.blaze.net.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <Pine.SOL.3.93.960829094459.4115A-100000@venice.rp.CSIRO.AU> <50jfru$2ce@cdn_news.telecom.com.au> <3235AF60.2A4D@trw.com> <slrn53bv32.b7.ghie@spleen.FrankenNet.net> <32429f76.3610232@news.surfsouth.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10669a,5eb45b939c7acd9e
X-Google-Attributes: gid10669a,public
X-Google-Thread: 102983,5eb45b939c7acd9e
X-Google-Attributes: gid102983,public
X-Google-Thread: f9b51,5eb45b939c7acd9e
X-Google-Attributes: gidf9b51,public
From: davidn@sdev.blaze.net.au (David Nugent)
Subject: Re: HOW: RedHat 3.0.3 - Setting up network stuff
Date: 1996/09/25
Message-ID: <slrn54juhu.g05.davidn@sdev.blaze.net.au>
X-Deja-AN: 185291726
references: <Pine.SOL.3.93.960829094459.4115A-100000@venice.rp.CSIRO.AU> <50jfru$2ce@cdn_news.telecom.com.au> <3235AF60.2A4D@trw.com> <slrn53bv32.b7.ghie@spleen.FrankenNet.net> <32429f76.3610232@news.surfsouth.com>
organization: Artel Computing Pty Ltd, Melbourne, Australia
reply-to: davidn@blaze.net.au
newsgroups: aus.computers.linux,comp.os.linux.setup,comp.os.linux.networking