Linux distro of choice? (57)

11 Name: Redhatter 2005-11-11 13:24 ID:kC45xWS+

Yeah... that was one of Slackware's biggest advantages, IMHO... was the BSD-style init scripts.

/etc/rc.d/rc.modules -- loaded kernel modules (drivers)
/etc/rc.d/rc.inet1 -- configured your network
/etc/rc.d/rc.inet2 -- started up daemons
/etc/rc.d/rc.local -- misc stuff

There were others too... it was neat! It did mean you needed to edit these files yourself to start daemons, but it wasn't so bad, and worked rather well. Very flexible, but it did mean more work maintaining your boot scripts.

Red Hat, Debian, SuSE, Ubuntu, and just about any other distro you care to mention use SystemV-style init scripts. That is, in /etc/rc#.d (where # is the runlevel -- 1 to 5), you have a bunch of symlinks pointing to scripts in /etc/init.d (or /etc/rc.d/init.d in earlier versions of Red Hat).

The symlinks were named, S##servicename -- for services to be started in that runlevel... and K##servicename -- for services to be killed. The ## bit was a number, indicating the order of things to take place. The script to kick this all off (called from init), therefore looked a little like this:

#!/bin/bash
# rc -- Start and stop runlevel services
#

# Get the new runlevel
runlevel=$1
shift

# Get the last runlevel
oldrunlevel=$(< /var/lib/runlevel )

# Leave the old runlevel...killing its services in order:
for service in /etc/rc${oldrunlevel}.d/K*; do
$service stop
done

# Start services for new runlevel
for service in /etc/rc${runlevel}.d/S*; do
$service start
done

# Store the new runlevel for reference later
echo ${runlevel} > /var/lib/runlevel

And in /etc/inittab...

l0:0:wait:/sbin/rc 0
l1:S1:wait:/sbin/rc 1
....
l5:5:wait:/sbin/rc 5
l6:6:wait:/sbin/rc 6

Now, my only complaint with these two, is that it's a bitch knowing which order services are to be started in. Removing a service from several runlevels with the SysV scripts, without the use of some tool, is repeticious tedium. Adding a script is even worse.

Gentoo's system was a breath of fresh air. It uses named runlevels (how many people would know runlevel 0 was halt and runlevel 6 was reboot?) and dependancies are tracked. i.e. if the machine tries to bring up a DHCP-configured ethernet adaptor, it won't try running NTP -- because presumably the NTP server will be inaccessible. It also allows for parallel starts.

It's not to bad to configure. There's rc-update to do things for you... but doing it by hand is easy too. Inside /etc/runlevels, there's a bunch of directories, one for each named runlevel. Inside that, is symlinks to the init scripts to be started. Want to start a service in the default runlevel? Easy, just ln -s /etc/init.d/SERVICE /etc/runlevels/default, and you're done. No order numbers to worry about (as in SysV), or knowing where in the script file to place the start service line (BSD).

As for the point of Gentoo on slow boxes -- this is where Debian has a significant edge, as nothing needs to be compiled. However, if you have a few powerful boxes running Gentoo, and your CFLAGS are set appropriately, it's not that difficult to emerge -B a package to produce a binary for the slow box in the cluster. You can also use distcc, which will throw the compile jobs (but not linking) around the network.

This thread has been closed. You cannot post in this thread any longer.