Init is the mother of all processes – it is the first
process a UNIX® system starts up and it manages all runlevel
changes and essential programs (getty
, and, on some systems
xdm
.) It reads the file /etc/inittab
to find out
what processes to run and when to run them.
The Mastodon init setup is a service based one, where each init script starts a particular system service and refers to the other services by name. init maintains an incore registry of active services – each init script queries this database to see if its prerequisites are running and starts them if they aren’t.
Init puts the system into one of 4 different runlevels:
S
)ingle-userM
)ultiuserR
)ebootingH
)altingr
runlevel, except that it will go back into
multiuser mode if you press a key at the **system halted**
prompt.The init package comes with the following programs:
init
shutdown
halts or reboots the system by either telling
init
to change to the appropriate runlevel or by just blindly
taking the machine down.wall
writes a message to everyone on the system.mesg
sets your terminal to allow or deny messages.showreg
shows all the processes currently registered.halt
(and reboot
) halt (and reboot) the system,
either by telling init
to go to runlevel h
(r
) or by
bringing down the system by themselves.need
queries the init
service registry for a process,
and if not found, starts that process and registers it. Need
assumes that your system has the init scripts in the directories
/etc/rc.d/rc.*
and /etc/rc.d/init.d
.runlevel
displays the current runlevel.telinit
tells init
what runlevel you wish to change
to. It is also used to tell init to reread /etc/inittab
after it’s been changed.check
checks /etc/inittab
for validity.shutdown
to not ask for a message
unless you give the -m
flag and checks in a fix to stop it
from getting confused about how long to wait before entering
OhMyGodProcessesWon'tStopTimeToPanicNow! mode during
shutdown.