NAME
inittab - format of the inittab file used by the sysv-compatible
init process
初始化表 - 一个整合初始化进程的表,初始化进程协调系统服务。inittab就是这样的文件格式。
DESCRIPTION (描述)
The inittab file describes which processes are started at bootup
and during normal operation (e.g. /etc/init.d/boot,
/etc/init.d/rc, gettys...). Init(8) distinguishes multiple run-
levels, each of which can have its own set of processes that are
started. Valid runlevels are 0-6 plus A, B, and C for ondemand
entries. An entry in the inittab file has the following format:
inittab文件描述在系统引导之后,正常的操作下的启动之后的进程的启动。Init(8)辨别多重运行级别,每一个运行级别都启动她自己设定的一些进程。正常的运行级别按照所需条目输入0-6加上A ,B,C。在inittab文件中的条目有下面这样一些格式。
id:runlevels:action:process
Lines beginning with ‘#’ are ignored.忽略开头是#的行。
id is a unique sequence of 1-4 characters which identifies
an entry in inittab (for versions of sysvinit compiled
with the old libc5 (< 5.2.18) or a.out libraries the
limit is 2 characters).
id 是inittab里唯一的一个1-4个字符辨别一个条目。(系统收集服务的版本通过老的libc5(小于5.2.18版本)或者是a.out库限制两个字符、)
Note: traditionally, for getty and other login processes,
the value of the id field is kept the same as the suffix
of the corresponding tty, e.g. 1 for tty1. Some ancient
login accounting programs might expect this, though I
can’t think of any.
注意:在传统上,对getty和其他的登录进程来说,id领域的值保持和相对应的tty后缀的值一样。比如:1对应着tty1,一些古老的账号程序可能预计会是这样,尽管我还没想到其他的。
runlevels 运行级别
lists the runlevels for which the specified action should
be taken.
列出运行级别,指定应该采取的动作。
action 动作
describes which action should be taken.
描述应该采取的动作。
process 进程
specifies the process to be executed. If the process
field starts with a ‘+’ character, init will not do utmp
and wtmp accounting for that process. This is needed for
gettys that insist on doing their own utmp/wtmp house-
keeping. This is also a historic bug.
详细表述进程的执行。如果进程领域以+开始,init将不记录进程登录非登录的原因。这就需要gettys坚持做他们自己的utmp/wtmp房屋保持。这也是个历史bug。
----------------------------------------------------------------------------------
The runlevels field may contain multiple characters for differ-
ent runlevels. For example, 123 specifies that the process
should be started in runlevels 1, 2, and 3. The runlevels for
ondemand entries may contain an A, B, or C. The runlevels field
of sysinit, boot, and bootwait entries are ignored.
不同的运行级别有着多重的特征。举个例子,1,2,3详细指定了进程应该在1,2,3的级别上运行。运行级别按照所需的条目包含A,B,C。运行级别忽略系统初始化,启动和启动等待。
When the system runlevel is changed, any running processes that
are not specified for the new runlevel are killed, first with
SIGTERM, then with SIGKILL.
当系统运行级别发生变化,任何不再指定给新的运行级别的进程将被杀死,先发送SIGTERM信号,再发送SIGKILL信号。
Valid actions for the action field are:动作领域里正常的动作是:
respawn
The process will be restarted whenever it terminates
(e.g. getty).
在任何时候,进程在结束后自动重启。
wait The process will be started once when the specified run-
level is entered and init will wait for its termination.
等待 一旦当输入指定的运行级别,进程将被启动。init将等待进程结束。(不重新启动。)
once The process will be executed once when the specified run-
level is entered.当指定运行级别之后,进程将被执行一次。
boot The process will be executed during system boot. The
runlevels field is ignored.在系统启动期间,进程将被执行,忽略欲行级别的领域。
bootwait
The process will be executed during system boot, while
init waits for its termination (e.g. /etc/rc). The run-
levels field is ignored.在系统启动期间,进程将被执行,当初始化等待结束。忽略运行级别。
off This does nothing.什么都不做。
ondemand 按照请求
A process marked with an ondemand runlevel will be exe-
cuted whenever the specified ondemand runlevel is called.
However, no runlevel change will occur (ondemand run-
levels are ‘a’, ‘b’, and ‘c’).进程按照所需的请求被标记,当任何指定所需的运行级别被呼叫的时候,执行运行级别内的进程。然而,没有运行级别的改变将被执行。(所需的运行级别是‘a’,‘b’和‘c’)
initdefault 默认运行级别
An initdefault entry specifies the runlevel which should
be entered after system boot. If none exists, init will
ask for a runlevel on the console. The process field is
ignored.
默认运行级别指定了当系统启动之后应该执行的运行级别的条目。如果没有条目存在,初始化将在控制台请求一个运行级别,忽略进程领域。
sysinit 系统初始化
The process will be executed during system boot. It will
be executed before any boot or bootwait entries. The
runlevels field is ignored.
进程将在系统启动的时候运行,进程将在任何boot或者是bootwait条目之前运行,忽略运行级别领域。
powerwait
The process will be executed when the power goes down.
Init is usually informed about this by a process talking
to a UPS connected to the computer. Init will wait for
the process to finish before continuing.
当系统掉电的时候执行进程,init进程通常使用一个和电脑相连接的对话进程告知。init将在继续之前等待进程结束。
powerfail
As for powerwait, except that init does not wait for the
process’s completion.
init进程不再等待进程结束。
powerokwait
This process will be executed as soon as init is infor-
mormed that the power has been restored.一告知被恢复的电源,进程就被执行。
powerfailnow
This process will be executed when init is told that the
battery of the external UPS is almost empty and the power
is failing (provided that the external UPS and the moni-
toring process are able to detect this condition).
ctrlaltdel
The process will be executed when init receives the SIG-
INT signal. This means that someone on the system con-
sole has pressed the CTRL-ALT-DEL key combination. Typi-
cally one wants to execute some sort of shutdown either
to get into single-user level or to reboot the machine.
kbrequest
The process will be executed when init receives a signal
from the keyboard handler that a special key combination
was pressed on the console keyboard.
The documentation for this function is not complete yet;
more documentation can be found in the kbd-x.xx packages
(most recent was kbd-0.94 at the time of this writing).
Basically you want to map some keyboard combination to
the "KeyboardSignal" action. For example, to map Alt-
Uparrow for this purpose use the following in your
keymaps file:
alt keycode 103 = KeyboardSignal
EXAMPLES
This is an example of a inittab which resembles the old Linux
inittab:
# inittab for linux
id:1:initdefault:
rc::bootwait:/etc/rc
1:1:respawn:/etc/getty 9600 tty1
2:1:respawn:/etc/getty 9600 tty2
3:1:respawn:/etc/getty 9600 tty3
4:1:respawn:/etc/getty 9600 tty4
This inittab file executes /etc/rc during boot and starts gettys
on tty1-tty4.
A more elaborate inittab with different runlevels (see the com-
ments inside):
# Level to run in
id:2:initdefault:
# Boot-time system configuration/initialization script.
si::sysinit:/etc/rc.sysinit
# What to do in single-user mode.
~:S:wait:/sbin/sulogin
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/rc 0
l1:1:wait:/etc/rc 1
l2:2:wait:/etc/rc 2
l3:3:wait:/etc/rc 3
l4:4:wait:/etc/rc 4
l5:5:wait:/etc/rc 5
l6:6:wait:/etc/rc 6
# What to do at the "3 finger salute".
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
# Runlevel 2,3: getty on virtual consoles
# Runlevel 3: mgetty on terminal (ttyS0) and modem (ttyS1)
1:23:respawn:/sbin/mingetty tty1
2:23:respawn:/sbin/mingetty tty2
3:23:respawn:/sbin/mingetty tty3
4:23:respawn:/sbin/mingetty tty4
S0:3:respawn:/sbin/agetty ttyS0 9600 vt100-nav
S1:3:respawn:/sbin/mgetty -x0 -D ttyS1
阅读(2728) | 评论(0) | 转发(0) |