博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
INITTAB详解
阅读量:2435 次
发布时间:2019-05-10

本文共 5669 字,大约阅读时间需要 18 分钟。

INITTAB

This document was created by using the manual pages.
Section: Linux System Administrator's Manual (5)
Updated: May 19, 1998

NAME

inittab - format of the inittab file used by the sysv-compatible init process

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...).
(8) distinguishes multiple
runlevels, 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:

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 libraries < 5.2.18 or a.out libraries the limit is 2 characters).

Note: For gettys or other login processes, the id field should be the tty suffix of the corresponding tty, e.g.1 for tty1. Otherwise, the login accounting might not work correctly.

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 housekeeping. This is also a historic bug.

The runlevels field may contain multiple characters for different runlevels. For example,123 specifies that the process should be started in runlevels 1, 2, and 3. Therunlevels for ondemand entries may contain an A,B, or C. The runlevels field of sysinit, boot, and bootwait entries are ignored.

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.

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 runlevel is entered and
init will wait for its termination.
once
The process will be executed once when the specified runlevel 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
runlevels field is ignored.
off
This does nothing.
ondemand
A process marked with an
ondemand runlevel will be executed whenever the specified
ondemand runlevel is called. However, no runlevel change will occur (
ondemand runlevels are `a', `b', and `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.
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.
powerfail
As for
powerwait, except that
init does not wait for the process's completion.
powerokwait
This process will be executed as soon as
init is informormed 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 monitoring process are able to detect this condition).
ctrlaltdel
The process will be executed when
init receives the SIGINT signal. This means that someone on the system console has pressed the
CTRL-ALT-DEL key combination. Typically 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 linuxid:1:initdefault:rc::bootwait:/etc/rc1:1:respawn:/etc/getty 9600 tty12:1:respawn:/etc/getty 9600 tty23:1:respawn:/etc/getty 9600 tty34: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 comments inside):

# Level to run inid:2:initdefault:# System initialization before anything else.si::sysinit:/etc/rc.d/bcheckrc# Runlevel 0,6 is halt and reboot, 1 is maintenance mode.l0:0:wait:/etc/rc.d/rc.haltl1:1:wait:/etc/rc.d/rc.singlel2:2345:wait:/etc/rc.d/rc.multil6:6:wait:/etc/rc.d/rc.reboot# What to do at the "3 finger salute".ca::ctrlaltdel:/sbin/shutdown -t5 -rf now# Runlevel 2&3: getty on console, level 3 also getty on modem port.1:23:respawn:/sbin/getty tty1 VC linux2:23:respawn:/sbin/getty tty2 VC linux3:23:respawn:/sbin/getty tty3 VC linux4:23:respawn:/sbin/getty tty4 VC linuxS2:3:respawn:/sbin/uugetty ttyS2 M19200

FILES

/etc/inittab

AUTHOR

Init was written by Miquel van Smoorenburg (). This manual page was written by Sebastian Lederer () and modified by Michael Haardt ().

SEE ALSO

(8),
(8)


Index


,

转载地址:http://gdhmb.baihongyu.com/

你可能感兴趣的文章
Cookie对象入门详解
查看>>
HashMap的remove()方法详解
查看>>
单例模式-分解步骤,逐步解析
查看>>
通过Form表单一次性拿到json格式数据,及后台接收
查看>>
## EL表达式与JSTL标签用法解读
查看>>
Mybatis异常:The content of elements must consist of well-formed.......(一般出现在写分页/带大于小于号的SQL)
查看>>
Mybatis光速入门(配置文件模块)
查看>>
关于Oracle的主键自增如何设置
查看>>
手撕HashMap的resize()方法源码渗透解析+图解
查看>>
Mybatis常见异常类型Could not set parameters for mapping离不开这个原因!
查看>>
Thymeleaf中一个页面怎么嵌套另一个页面,关于页面嵌套,标签告诉你应该知道的
查看>>
JAVA如何实现短信验证码--阿里云接口,新手式图文教学,个人项目有这一篇就够了
查看>>
Java中大小数BigDecimal的加减乘除用法及场景的详细介绍,看完不信你还会报Syntax error on token “+/-/*“, invalid AssignmentOperat异常
查看>>
UVa 10917 Dijkstra
查看>>
CF403B/CF402D
查看>>
CF402E / 403C
查看>>
cf404b
查看>>
cf404c
查看>>
cf404d
查看>>
武大网络预赛 Problem 1545 - I - Twenty-four
查看>>