Using Linux:Managing Scheduling Services
-->
Previous
Table of Contents
Next
action and process are easily confused. The action is what init does, not what the process does. There are 14 possible actions, as illustrated in Table 26.2.
Table 26.2 Possible actions init can take
Action
Description
respawn
init restarts the process whenever the process terminates.
wait
init starts this process, and waits for it to complete before continuing to the next process.
once
init starts this process and moves on. If/when this process terminates, it is not restarted.
boot
This process runs during system boot. The runlevel field is ignored.
bootwait
init starts this process at system boot, and waits for it to complete before continuing. The runlevel field is ignored.
off
This does not run.
ondemand
This process is run whenever the specified ondemand run level is called. No actual run level change occurs. ondemand run levels are a, b, and c.
initdefault
This entry specifies the run level that should be entered after system boot. If none exists, init asks for a run level on the console. The process field is ignored. The default value is 3.
sysinit
This process is executed during system boot, and before any boot or bootwait entries. The runlevel field is ignored.
powerwait
This process is executed when init receives the SIGPWR signal, indicating that there is something wrong with power. init waits for the process to finish before continuing.
powerfail
This process is executed when init receives the SIGPWR signal, indicating that there is something wrong with power. init does not wait for the process to finish before continuing.
powerokwait
init executes this command when it receives the SIGPWR signal, provided that there is a file called /etc/powerstatus containing the word OK. This indicates that the power has come back on again.
ctrlaltdel
init executes this process when it receives the SIGINT signal. This means that someone on the system console has pressed the Ctrl+Alt+Del key combination. Typically, this is either a shutdown command or a boot to single-user mode.
kbrequest
This is one of the newer actions. When init receives a signal from the keyboard handler that a special key combination was pressed on the console keyboard, then this command is executed. See documentation found in the kbd-x.xx package for more information.
Listing 26.1 shows an example inittab file from a machine running Red Hat Linux 5.0.
Listing 26.1 A sample inittab file from a system running Red Hat Linux 5.0
#
# inittab This file describes how the INIT process should set up
# the system in a certain run-level.
#
# Author: Miquel van Smoorenburg,<miquels@drinkel.nl.mugnet.org>
# Modified for RHS Linux by Marc Ewing and Donnie Barnes
#
# Default run level. The run levels used by RHS are:
# 0 - halt (Do NOT set initdefault to this)
# 1 - Single user mode
# 2 - Multiuser, without NFS (The same as 3, if you do not have
networking)
# 3 - Full multiuser mode
# 4 - unused
# 5 - X11
# 6 - reboot (Do NOT set initdefault to this)
#
id:3:initdefault:
# System initialization.
si::sysinit:/etc/rc.d/rc.sysinit
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6
# Things to run in every run level.
ud::once:/sbin/update
# Trap CTRL-ALT-DELETE
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
# When our UPS tells us power has failed, assume we have a few minutes
# of power left. Schedule a shutdown for 2 minutes from now.
# This does, of course, assume you have powerd installed and your
# UPS connected and working correctly.
pf::powerfail:/sbin/shutdown -f -h +2 Power Failure; System Shutting
Down
# If power was restored before the shutdown kicked in, cancel it.
pr:12345:powerokwait:/sbin/shutdown -c Power Restored; Shutdown
Cancelled
# Run gettys in standard run levels
1:12345:respawn:/sbin/mingetty tty1
2:2345:respawn:/sbin/mingetty tty2
3:2345:respawn:/sbin/mingetty tty3
4:2345:respawn:/sbin/mingetty tty4
5:2345:respawn:/sbin/mingetty tty5
6:2345:respawn:/sbin/mingetty tty6
# Run xdm in run level 5
x:5:respawn:/usr/bin/X11/xdm -nodaemon
A number of the lines should now be familiar. It is good to point out that the id of each of these entries corresponds with the entry itself (for example, pf = power fail). This is a good habit to get into. Also, from the lilo line, you can specify a level by entering the following (in which # is the runtime level you want to use):
linux #
Previous
Table of Contents
Next
Wyszukiwarka
Podobne podstrony:
429 431431 (B2007) Sporządzenie rocznego sprawozdania finasowego wazne terminy i informacje04 (431)431,16,artykulindex (434)launch x 43112 (431)434 437 skyj5qunzjzrcit5qhjbvmlghvyocvxwdhfqrha02 (431)02 (434)434 acwięcej podobnych podstron