ランレベル別のディレクトリ(/etc/rc.d/rc*.d)にあるファイル(実際には各プログラムの起動スクリプトへのリンク)の名前により、各ランレベルで実行するプログラムを指定している。
0 停止
1 シングルユーザーモード
2 マルチユーザーモード(テキストログイン,Network無し)
3 通常のマルチユーザーモード(テキストログイン)
4 未使用
5 マルチユーザーモード(グラフィカルログイン)
6 再起動
S シングルユーザーモード(/etc/rc.d/rc.sysinitを実行)
[root@localhost ~]# ls -l /etc/rc.d/rc.sysinit
-rwxr-xr-x 1 root root 26613 3月 22 2007 /etc/rc.d/rc.sysinit
[root@localhost ~]#
「S」はStart
「K」はKill
KやSに続く数字は、実行されるスクリプトの優先順位だ。数字の小さいスクリプトから順に実行される。
Webサービス等の起動ファイルが/etc/init.d/に配置されていて,/etc/rc*.d以下のファイルはシンボリックリンクに設定。
chkconfigでも設定確認できる。(RH系ディストリビューション)
[root@localhost ~]# /sbin/chkconfig –list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@localhost ~]#
[root@localhost ~]# runlevel
N 3 ←現在のRun Level
[root@localhost ~]#
※ランレベルの変更をするには,initコマンドもしくはtelinitコマンドを利用します。(左は前のランレベル”N”)
※rootのパスワードを忘れた場合でも,シングルユーザーモードではログイン無しでシステム利用出来るので,
パスワードの再設定を行う事が出来ます。パスワードを必要とするディストリビューションもあります。
またパスワードを必要とするように設定する事も出来る。
※ディフォルトランレベル
[root@localhost ~]# cat /etc/inittab
#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg, <miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#
# Default runlevel. The runlevels used by RHS are:
# 0 – halt (Do NOT set initdefault to this)
# 1 – Single user mode
# 2 – Multiuser, without NFS (The same as 3, if you do not have networking)
# 3 – Full multiuser mode
# 4 – unused
# 5 – X11
# 6 – reboot (Do NOT set initdefault to this)
#
id:3:initdefault:
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit