table of contents
| INITTAB(5) | File Formats | INITTAB(5) |
NOMBRE¶
inittab - formato del fichero inittab usado por el proceso init compatible SysV
DESCRIPCIÓN¶
El fichero inittab describe qué procesos se inician en la carga y durante la operación normal (por ejemplo, /etc/init.d/boot, /etc/init.d/rc, gettys...). init(8) distingue múltiples niveles de ejecución, cada uno de los cuales puede tener su propio conjunto de procesos que se inician. Los niveles de ejecución válidos son 0-6 más A, B y C para entradas bajo demanda. Una entrada del fichero inittab tiene el siguiente formato:
id:niveles_ejecución:acción:proceso
- 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).
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.
- niveles_ejecución
- es la lista de niveles de ejecución para lo cuales se llevarán a cabo las acciones especificadas.
- acción
- describe qué acción se debería llevar a cabo.
- proceso
- 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 length of this
field is limited to 253 characters. Anything beyond 253 will result in a
log warning and the process command line being skipped/ignored.
Please note that including certain characters in the process field will result in init attempting to launch a shell to interpret the command contained in the process field. The characters which will trigger a shell are: ~`!$^&*()=|}[];"'<>?
On systems which do not have a shell to be launched or which do not wish to use a shell to interpret the process field, the process field can be prefixed with the @ symbol. The @ will be ignored and everything followed will be treated as a command to be launched, literally, by the init service.
In cases where both a + and @ sign are to be used (to turn off logging and shell interpretation), place the + sign before the @ symbol. Both flags will be handled and then everything following the @ will be handled by init
El campo niveles_ejecución tiene que contener múltiples caracteres para diferente niveles de ejecución. Por ejemplo, 123 especifica que el proceso se debería iniciar en los niveles de ejecución 1, 2 y 3. Las entrada de niveles de ejecución bajo demanda pueden contener una A, B, o C. Las entradas de campos de nivel_ejecución de sysinit, boot y bootwait se ignoran.
Cuando se cambia un nivel de ejecución, cualesquiera procesos en ejecución que no estén especificados en el nuevo nivel de ejecución se matan, primero con SIGTERM y después con SIGKILL.
Acciones válidas para el campo acción son:
- respawn
- El proceso se reiniciará cuando termine (v.g. getty).
- wait
- El proceso se iniciará una vez cuando se entre en el nivel de ejecución específico e init esperará a su terminación.
- once
- El proceso se ejecutará una vez cuando se entre en el nivel de ejecución especificado.
- boot
- El proceso se ejecutará durante el arranque del sistema. El campo The niveles_ejecución se ignora.
- bootwait
- El proceso se ejecutará durante el arranque del sistema, mientras init espera su terminación (v.g. /etc/rc). El campo niveles_ejección se ignora.
- off
- Esto no hace nada.
- ondemand
- Un proceso marcado con un nivel de ejecución ondemand se ejecutará cuando se llame al nivel de ejecución especificado ondemand. Sin embargo, no se produce cambio de nivel de ejecución (los niveles de ejecución ondemand son `a', `b', y `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
- Como en powerwait, excepto que init no espera que el proceso se complete.
- powerokwait
- This process will be executed as soon as init is informed that the power has been restored.
- powerfailnow
- Como en powerwait, excepto que init no espera que el proceso se complete.
- 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
- El proceso se ejecutará cuando init reciba una señal
del gestor de teclado que se ha pulsado una combinación especial de
teclas en el teclado de la consola.
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
Note: In environments where the directory /etc/inittab.d/ exists, init will read the contents of this directory and open any files with the ".tab" extension. These .tab files can introduce additional lines and settings with the same format as inittab. The .tab files are optional and provide a install-specific method for adding extra options or functionality.
EJEMPLOS¶
Esto es un ejemplo de un inittab que reensambla el viejo inittab de Linux:
# inittab para 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
Un inittab más elaborado con diferentes niveles de ejecución (vea los comentarios interiores):
# Nivel para ejecutar id:2:initdefault: # Boot-time system configuration/initialization script. si::sysinit:/etc/init.d/rcS # 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/init.d/rc 0 l1:1:wait:/etc/init.d/rc 1 l2:2:wait:/etc/init.d/rc 2 l3:3:wait:/etc/init.d/rc 3 l4:4:wait:/etc/init.d/rc 4 l5:5:wait:/etc/init.d/rc 5 l6:6:wait:/etc/init.d/rc 6 # Qué hacer ante el "saludo de 3 dedos". ca::ctrlaltdel:/sbin/shutdown -t1 -h now # Runlevel 2,3: getty on virtual consoles # Runlevel 3: getty on terminal (ttyS0) and modem (ttyS1) 1:23:respawn:/sbin/getty tty1 VC linux 2:23:respawn:/sbin/getty tty2 VC linux 3:23:respawn:/sbin/getty tty3 VC linux 4:23:respawn:/sbin/getty tty4 VC linux S0:3:respawn:/sbin/getty -L 9600 ttyS0 vt320 S1:3:respawn:/sbin/mgetty -x0 -D ttyS1
ARCHIVOS¶
/etc/inittab
AUTOR¶
Init fue escrito por Miquel van Smoorenburg. Esta página de manual fue escrita por Sebastian Lederer y modificada por Michael Haardt.
VÉASE TAMBIÉN¶
| 4 de diciembre de 2001 | sysvinit |