To quote "M.B.Midden" <[EMAIL PROTECTED]>, # Im looking for some info about runlevels. Is there a howto for it? What is # the best runlevel for a server en when should u switch ( how can you switch) # ( i tried man runlevel ofcourse ) etc
I'm sort of bored, so here's a little tutorial ;) Each runlevel has an associated directory in /etc . /etc/rc0.d/* : Used to halt the system. /etc/rc1.d/* : Used to put the system into single-user mode(after another runlevel has already been reached). Similar to "Safe Mode" from MS Windows. /etc/rc2.d/* : Regular multi-user runlevel. /etc/rc3.d/* : Regular multi-user runlevel. /etc/rc4.d/* : Regular multi-user runlevel. /etc/rc5.d/* : Regular multi-user runlevel. /etc/rc6.d/* : Used to reboot the system. /etc/rcS.d/* : General not used manually, it's used to put the system into single-user mode right after the kernel has been started. Usually entered by typing "linux single" at the LILO prompt. Runlevels 0, 1, 6, and S generally arn't modified by the user, which leaves runleves 2, 3, 4, and 5. Within all of these directories are a number of symbolic links to scripts within /etc/init.d . When the symbolic link's name start with "S", that means the appropriate script is executed with the argument "start". So, for instance, if there is a symbolink link /etc/rc2.d/S20gpm -> /etc/init.d/gpm , then '/etc/init.d/gpm start' is run. You'll notice there's a number between the "S" and the script name. That's the priority by which the script is run. The scripts are executed serially, lower numbers starting first. When a symbolic link's name starts with "K", the appropriate script is run with the "stop" argument. The same rules about priorities are used. When you enter a runlevel, all the scripts are called. Runlevel 6, for instance, calls(at the very end) /etc/init.d/reboot, so the computer reboots. When you type 'reboot' at the command line, you're basically entering runlevel 6. By default, your Debian system enters runlevel 2 on boot. Also by default on your Debian system, runlevels 2, 3, 4, and 5 are exactly the same. There's no difference between them until you make them different. Now, to answer your question :) By default, the user-defined runlevels are all the same, so there's no "best server runlevel". However, you can manually change the symbolic links(either using strict 'ln' and 'rm' commands, or(prefferably) using 'update-rc.d'), so that runlevel 3, for instance, starts all your regular Internet/Intranet services(apache, inetd, pop3d, and friends), and you can make runlevel 2 start your regular desktop(no apache, no identd, nothing you don't use) with X and your font servers and everything else you regularily use. Okay, I've wasted enough of your time ;) For some good, in-depth(but still understandable) information, check out the man pages for 'init' and 'update-rc.d'. You can also read the man page for /bin/init's configuration file, 'inittab', but I find t somewhat more difficult to understand. Oh, and if you do decide to change which services go into which runlevels, always use 'update-rc.d'. :) Dave