| INITTAB(5) | File Formats | INITTAB(5) |
NAZWA¶
inittab - format pliku inittab używanego przez proces init, kompatybilny z sysv
OPIS¶
Plik inittab opisuje które procesy zostały uruchomione podczas startu i podczas normalnego działania (np. /etc/init.d/boot, /etc/init.d/rc, getty...). init(8) rozróżnia różne poziomy pracy, z których każdy może mieć swój własny zestaw procesów uruchamianych na starcie. Dopuszczalne poziomy pracy to 0-6 i A, B i C dla wpisów ondemand (na żądanie). Wpis w pliku inittab ma następujący format:
id:poziomy pracy:akcja:proces
- 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.
- poziomy pracy
- opisują, w których poziomach pracy podjąć podaną akcję.
- akcja
- opisuje jaką akcję podjąć.
- proces
- 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
Pole poziomy pracy może zawierać wiele znaków dla różnych poziomów. Na przykład, 123 określa, że proces powinien być uruchamiany w poziomach pracy 1, 2 i 3. poziomy pracy do wpisów ondemand mogą zawierać A, B lub C. Pole to jest ignorowane w przypadku następujących wpisów: sysinit, boot i bootwait.
Gdy poziom pracy jest zmieniany, zabijane są wszystkie procesy, które nie są podane w nowym poziomie pracy, zaczynając od sygnału SIGTERM, a następnie SIGKILL.
Dopuszczalne akcje w polu akcje to:
- respawn
- Proces będzie uruchomiony od nowa po każdym jego zakończeniu (np. getty).
- wait
- Proces będzie uruchomiony raz (gdy nadejdzie właściwy poziom pracy), a init będzie czekał na jego zakończenie.
- once
- Proces będzie wywołany raz po wejściu we właściwy poziom pracy.
- boot
- Proces zostanie wywołany podczas rozruchu. Pole poziomy pracy jest ignorowane.
- bootwait
- Proces zostanie wywołany podczas rozruchu, podczas gdy init czeka na jego zakończenie (np. /etc/rc). Pole poziomy pracy jest ignorowane.
- off
- Nie robi nic.
- ondemand
- Proces, który jest zaznaczony poziomem pracy ondemand będzie wywoływany za każdym razem, gdy zostanie wywołany wskazany poziom żądania. Mimo to jednak, nie nastąpi zmiana poziomu pracy (poziomy pracy ondemand to "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.
- 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
- Podobne do powerwait, lecz init nie będzie czekał na zakończenie tego procesu.
- powerokwait
- Proces zostanie wywołany, gdy init otrzyma sygnał, że zasilanie zostało przywrócone.
- powerfailow
- Proces zostanie wykonany, gdy init dowie się o krytycznym poziomie baterii zewnętrznego UPS-a i o właśnie zawodzącym zasilaniu (jeśli zewnętrzny UPS i monitorujący go proces są w stanie wykryć taki stan).
- 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
- Proces zostanie wywołany gdy init otrzyma sygnał z
sterownika klawiatury, mówiący że na konsoli
została naciśnięta specjalna kombinacja klawiszy.
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.
PRZYKŁADY¶
Oto przykład inittab, który zawiera stary inittab Linuksa:
# inittab do Linuksa 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
Bardziej wykwintny inittab, z różnymi poziomami pracy (patrz komentarze):
# Poziom, w którym startować id:2:initdefault: # Skrypt inicjujący/konfigurujący system w czasie rozruchu. si::sysinit:/etc/init.d/rcS # Co robić w trybie jednoużytkownikowym. ~: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 # Co zrobić przy ctrl+alt+del. ca::ctrlaltdel:/sbin/shutdown -t1 -h now # Poziomy 2 i 3: getty na konsolach wirtualnych # Poziom 3: getty na terminalu (ttyS0) i modemie (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
PLIKI¶
/etc/inittab
AUTOR¶
init was written by Miquel van Smoorenburg. This manual page was written by Sebastian Lederer and modified by Michael Haardt.
ZOBACZ TAKŻE¶
| 4 grudnia 2001 | sysvinit |