There was a discussion about this recently... So I thought I'd mention this: This is posted on cola; looks neat to me:
----------------------------------------- From: Winfried Truemper <[EMAIL PROTECTED]> Newsgroups: comp.os.linux.announce Subject: r2d2 - reading runlevels in 2 dimensions The traditional "SysV" scheme of implementing runlevels uses links distributed over several directories under "/etc/rc?.d/*". The main problem with the links is that you can't easily get a survey of your setup. Yes, you can write a script like the one accompanied with this package but this is not satisfactory because it's another layer (another name of a program to know) and not editable. I rewrote the "rc"-program so it handles _one_ config file instead of many links in "/etc/rc?.d/*". Apart from the IMHO more intuitive configuration file it's fully compatible with the traditional SysV scheme. You can always fetch the newest version from ftp://www.shop.de/linux/local and soon from sunsite. Here's an extract from a sample config file: # This is the configuration file for /etc/init.d/runlevel.conf # #format: #<sort> <off> <on> <script> 05 - 0 /etc/init.d/halt 05 - 1 /etc/init.d/single 05 - 6 /etc/init.d/reboot 10 0,1,6 2,3,4,5 /etc/init.d/sysklogd 12 0,1,6 2,3,4,5 /etc/init.d/kerneld [..] 89 0,1,6 2,3,4,5 /etc/init.d/cron 99 - 2,3,4,5 /etc/init.d/rmnologin 99 0,1,6 2,3,4,5 /etc/init.d/xdm The syntax should be fairly obvious: * comments begin with the numbersign # * The first column is a criteria for inserting new entries. As there is no consens about a numbering scheme among systems claiming themselves to be SysV compatible, these numbers are not very useful but kept for higher psychological compatibility. * The second column consists of a comma-seperated list of runlevels in which the script should be switched "off" - or - a single "-" if the script should never be stopped (with that sort-number). * The third column consists of a comma-seperated list of runlevels in which the script should be switched "on" - or - a single "-" if the script should never be started (with that sort-number). * The last column specifies the full name of the script. "r2d2" uses built-in bash functions only and does not rely on any external program installed (my highest principle is: if you need to fork, something is messed up). Performance is quite good because evaluating a single file is faster than several hundred symbolic links under /etc. On my old 486/66 the delay between starting "r2d2" and the first script executed is about 2 seconds. A script named rclink2file.sh to convert your current link-setup into a configuration file is available as well as an almost compatible "update-rc.d"-program. To edit the configuration file you can use your favourite editor. :-) After unpacking the tar file you may want to try it out by issuing the commands ./rclink2file.sh > runlevel.conf export PRELEVEL=N # previous runlevel, N = Booting ./r2d2 2 # "switch" to runlevel "2" You don't need to be root to do this and to be on the save side, "r2d2" only prints the commands it would execute for now. IMPORTANT NOTE: if you like the alternate method you should think carefully about potential incompabilities with your distribution and potential problems with upgrading before you replace the old one. The disadvantages (which don't apply to the method with links) as far as I can see them: * Modifications require the whole file to be rewritten, which is a source for errors. On the other side this is only as bad as with /etc/passwd. * Inserting and removing entries is not done via "well-understood" utilities like "ln" and "rm". On the other side the scheme with links is not widely understood at all, so "ln" and "rm" don't really help. * The "sort numbers" are not evaluated by "r2d2". * Only very few system administrators (mad or heros?) have reported the usage of "r2d2" in a production environment to me, so the testbed is very small. Advantages beside the easeness: * You can easily make backups of the config file and use standard software like "diff" to compare "working" and "not working" configuration files. Try that with a bunch of several hundred symlinks. * The "sort numbers" are not evaluated by "rc". :-) * No special tool required, you can use your favorite editor to maintain the configuration manually. * Symbolic runlevels like "reboot" can be easily supported (although the numbers are more comprehensive). * The sort-numbers could be replaced by symbolic names, too. * "Update-rc.d" is quite fast (2-3s on an old ISA-486 = up to 10 times faster than the old one). Of course even more complicated setups can be expressed in the configuration file: #Format: #<sort> <on-> <off-levels> <script> 15 0 - /etc/init.d/foo 17 1 - /etc/init.d/foo 19 6 - /etc/init.d/foo 14 - 5 /etc/init.d/foo 80 - 2 /etc/init.d/foo 84 - 3,4 /etc/init.d/foo A man-page is planned for future releases. The mailinglist for discussion is [EMAIL PROTECTED], which has an archive under http://www.shop.de/linux/archives/r2d2. To subscribe send an email with the text "subscribe" to [EMAIL PROTECTED], e.g. by executing echo "subscribe" | mail [EMAIL PROTECTED] - -Winfried -- TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to [EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED] .