Re: BSD vs SysV init scripts

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Craig White
Date:  
To: plug-discuss
Subject: Re: BSD vs SysV init scripts
On Sun, 2005-01-23 at 15:54 -0700, Siri Amrit Kaur wrote:
> On Sunday 23 January 2005 12:08 pm, Jay kindly wrote:
> > On Sun, 23 Jan 2005, Siri Amrit Kaur wrote:
> > > Besides the BSD's, are there any Linux distros _NOT_ based on
> > > Slackware that use the BSD-style init scripts? The BSD-style of
> > > init scripts is one of my chief reasons for using Slackware.
> > >
> > > Most distros use SysV, and by default turn on a lot of services
> > > that I don't need or want. Except for Mandrake or PCLOS, which
> > > make it easy to turn off unneeded services, I find it confusing
> > > and hard to turn off services in a SysV system. I like Mepis and
> > > Ubuntu, but because they're Debian-based they use SysV-style init
> > > scripts and I can't figure out how to turn off unneeded services.
> >
> > I used to be a Slackware user from around 1994 - 1999. I wanted to
> > check out other distributions, but I also found the SysV init
> > process strange after so much Slackware time. However, once I poked
> > around at it, I actually learned to love SysV init, and still do
> > today as a Debian user.
> >
> > SysV is really quite simple once you understand the basic process
> > of runlevels (which are also present in BSD-style init, but just
> > more "hidden"). Do a "man init" will give you a good idea.
> > Basically, a crash-course would be:
> >
> > * There are several run levels your system can be in.
> >
> > * Run level 0 is for halt (shutdown), 1 is for booting up the
> > system, and 6 is for rebooting. There is also run level "S" (or "s"
> > - they are the same) which is also used for inital bootup into
> > single-user mode. All of these run levels are considered "reserved"
> > and you probably will not need to know much more about them unless
> > you really want to dig into it.
> >
> > * On most Linux systems, run level 2 is multi-user mode, console
> > only (no GUI). Great for servers. Run level 5 is multi-user mode
> > with a GUI (launching X11 automatically on boot-up). Your system is
> > likely in one of these two run levels.
> >
> > * To find out which run level your system is in, you could do the
> > geeky thing and examine /etc/inittab, or you could just run the
> > "runlevel" command with no arguments.
> >
> > Now, back to SysV init... There will be one big /etc/init.d/
> > directory containing all of the start/stop scripts for various
> > services. Yes, there should be a ton of stuff in there. There will
> > also be several /etc/rc<N>.d/ directories, where "<N>" is a run
> > level number. Inside /etc/rc<N>.d/ will just be some symlinks to
> > stuff that the system should run when entering or exiting that
> > particular run level. It is actually quite organized.
> >
> > If, for example, you are in run level 5 and do not want sendmail to
> > launch on boot, just remove the /etc/rc5.d/S21sendmail symlink.
> > Likewise, if you do want sendmail to launch on boot, just "ln -s
> > /etc/init.d/sendmail /etc/rc5.d/S21sendmail" - that is it.
> >
> > It may sound confusing, but hop on a SysV init based system and
> > tinker with it for a few minutes. You will find that it actually
> > makes a little sense. :)
>
> Thank you, Jay. Let me try to understand this:
>
> According to my /etc/inittab, I boot into runlevel 3,
> console/multiuser. Then I type "startx" to go into KDE or whatever.
> Once I'm in X am I still in runlevel 3? I thought I'd be in runlevel
> 4 or 5, but when I opened a shell in KDE, the "runlevel" command said
> I was still in runlevel 3.

---
that is correct, you are still at runlevel 3. You can type 'telinit 5'
or 'init 5' to change to runlevel 5.
---
>
> Do I have to delete or comment-out the symlinks in both runlevel 3 and
> 4-5? What if I decide to work for awhile in runlevel 1? Will the
> services start up there? I don't want to have to delete a ton of
> symlinks in all the runlevels.

---
better to use chkconfig system to enable/disable these rather than
manually deleting/creating them. Nice system in place for that.

As root...
chkconfig sendmail on
or
chkconfig --levels 2345 sendmail on
or
chkconfig --levels 35 sendmail on
chkconfig --levels 24 sendmail off

man chkconfig

Note that the line like...
# chkconfig: 2345 80 30

will set the location and levels of chkconfig commands. 2345 means
operate on those levels, 80 means start S80 and 30 is K30.
>
> > It may sound confusing, but hop on a SysV init based system and
> > tinker with it for a few minutes. You will find that it actually
> > makes a little sense. :)
>
> I've actually spent hours and hours studying this, and tried various
> little programs to edit the symlinks, and it just seems like a
> convoluted mess compared to the BSD-style init scripts in Slackware.
> Just my opinion.

---
man chkconfig - it's rather easy to manage once you play with it.

Editing the symlinks is foolish

Craig

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss