% The Mastodon init program % Jessica L. Parsons % Wed Jan 16 07:29:26 PST 2008 #Init for Mastodon Linux **Init** is the mother of all processes -- it is the first process a UNIX(r) 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](/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-user= This conventionally is just a single shell, with all filesystems except the root filesystem unmounted. =(**`M`**)ultiuser= This is the system as it normally functions, with all services running and accessable to users. =(**`R`**)ebooting= **init** goes into this runlevel when it's stopping all services and preparing to do a software reboot of the computer. =(**`H`**)alting= **init** goes into this runlevel when it's stopping all services and preparing to halt the computer. It's much like the **`r`** 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. ##Source Code =[version 1.1](init-1.1.tar.gz)= With manpages! It also changes `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. =[version 1.0](init-1.0.tar.gz)= The first release of init. It uses a fifo to pass commands into the init process, except for runlevel changes which are passed by signal. A few manpages were written for this release, but not very many.