201609121027Linux : inittab format work log

為了偷懶,想要在 kernel init 後,respawn 一些 process,所以使用 /etc/inittab 的功能。 

/etc/inittab 欄位說明,下面有三個例子

 

l6 : 6 : wait: /etc/rc.d/rc 6

::shutdown:/etc/rc.d/rcS stop

tty0 :: respawn : ~/bin/sh

 

(如果是空白欄位,大多是因為是每個 level 都要執行,)

第一個欄位是 process ID number,有設定的話,應該會被某些程式作為識別變數。

第二個欄位是 system run level,大概有 0~6 的階段,當 kernel 跑到該 level,就會執行相關工作。

第四個欄位是 執行的 prcoess absoulte path。

第三個欄位是 kernel 執行此 process 的動作,請見 man inittab 或 下面的敘述。

 

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

 

 

好了,整理完收工。

 

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 = KeyboardSigna

回應
BloggerVAds
關鍵字
累積 | 今日
loading......
    沒有新回應!
東亞衛星雲圖
東亞衛星雲圖
點圖開啟中央氣象局PDA網頁
+加強版 @Frank的雜記
Instant MSG
Since Apr.3 2015
Free counters!