/usr/share/doc/file-rc/README is in file-rc 0.8.18.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | A config file for runlevels
---------------------------
The traditional "SysV" scheme of implementing runlevels is through links
in "/etc/rc?.d/*". The main problem with this links is that you can't
get easily a survey of your setup.
I rewrote the "rc"-program so it handles _one_ config file instead of
many links in "/etc/rc?.d/*". Here's an extract from it's config file:
# This is the configuration file for /etc/debian/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:
* The first column is the sort criteria for starting and
stopping (reverse order) the scripts.
* 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 (within
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.
The alternate "rc"-programm uses built-in bash functions only and does
not rely on any external program installed. Performance is quite good
and delays execution of a script 0.075 seconds (average value on an old
ISA-486).
A script 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. :-)
With the files in this directory try
./rclink2file.sh > runlevel.conf
export PRELEVEL=N # previous runlevel, N = Booting
./rc 2 # "switch" to runlevel "2"
To be on the save side, the alternate "rc" only prints the commands
it would execute for now.
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.
* Inserting and removing is not done via well-understood utilities
like "ln" and "rm".
* The "sort numbers" are not evaluated by "rc" (this could be
seen as a feature, too).
* There is almost no experience with this new technique.
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.
* 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
|