Init process
Init takes a parameter: the
runlevel (1-6).
The «root» of all processes. Almost all
daemons are spawned by init.
After setting everthing up, init goes to sleep and is only woken up
- when process has ended
- a power failure signal was detected
- the runlevel is changed with
/sbin/telnit
The init process runs in user space.
Run levels
- S: Not really meant to be used directly. It's apparently used in conjunction with the action
sysinit
in order to go to runlevel 1 or more.
- 0: halt
- 1: Single user mode
- 2: Multi user, without networking (NFS) and GUI.
- 3: Full multi user mode, but still no GUI
- 4: user definable / undefined
- 5: Full multi user with display manager
- 6: reboot.
They determine which sub systems to run.
The runlevel is changed with /sbin/telnit
.
Some systems also have runlevels 7-9.
Apparently runlevels S
and s
are synonyms.
The source code of init
also talks about the fake run levels #
for SYSINIT and *
for BOOT and BOOTWAIT.
Init scripts
An init script requires an action (which is passed as a string to the script) which is one of start, stop, restart, try-restart, reload, force-reload or status.
Init scripts are located in /etc/rc*
.
When
init
starts a new process, it first checks whether the script
/etc/initscript
is available. If so, this script is used to start the process.