init - Unix, Linux Command

Runlevels 0, 1, and 6 are reserved. Runlevel 0 is used to
halt the system, runlevel 6 is used to reboot the system, and runlevel
1 is used to get the system down into single user mode. Runlevel S
is not really meant to be used directly, but more for the scripts that are
executed when entering runlevel 1. For more information on this,
see the manpages for shutdown(8) and inittab(5).


Runlevels 7-9 are also valid, though not really documented. This is
because "traditional" Unix variants don’t use them.
In case you’re curious, runlevels S and s are in fact the same.
Internally they are aliases for the same runlevel.




Runlevel S or s bring the system to single user mode
and do not require an /etc/inittab file.  In single user mode,
a root shell is opened on /dev/console.


When entering single user mode, init initializes the consoles
stty settings to sane values. Clocal mode is set. Hardware
speed and handshaking are not changed.


When entering a multi-user mode for the first time, init performs the
boot and bootwait entries to allow file systems to be
mounted before users can log in.  Then all entries matching the runlevel
are processed.


When starting a new process, init first checks whether the file
/etc/initscript exists. If it does, it uses this script to
start the process.


Each time a child terminates, init records the fact and the reason
it died in /var/run/utmp and /var/log/wtmp,
provided that these files exist.


If init is not in single user mode and receives a powerfail
signal (SIGPWR), it reads the file /etc/powerstatus. It then starts
a command based on the contents of this file:


Usage of SIGPWR and /etc/powerstatus is discouraged. Someone
wanting to interact with init should use the /dev/initctl
control channel - see the source code of the sysvinit package
for more documentation about this.


When init is requested to change the runlevel, it sends the
warning signal SIGTERM to all processes that are undefined
in the new runlevel.  It then waits 5 seconds before forcibly
terminating these processes via the SIGKILL signal.
Note that init assumes that all these processes (and their
descendants) remain in the same process group which init
originally created for them.  If any process changes its process group
affiliation it will not receive these signals.  Such processes need to
be terminated separately.


telinit can be invoked only by users with appropriate
privileges.


The init binary checks if it is init or telinit by looking
at its process id; the real init’s process id is always 1.
From this it follows that instead of calling telinit one can also
just use init instead as a shortcut.



/etc/inittab
/etc/initscript
/dev/console
/var/run/utmp
/var/log/wtmp
/dev/initctl

getty (1)
getty (1)
login (1)
login (1)
sh (1)
sh (1)
runlevel (8)
runlevel (8)
shutdown (8)
shutdown (8)
kill (1)
kill (1)

Advertisements


    129 Lectures 
     23 hours 

 Eduonix Learning Solutions

    5 Lectures 
     4.5 hours 

 Frahaan Hussain

    35 Lectures 
     2 hours 

 Pradeep D

    41 Lectures 
     2.5 hours 

 Musab Zayadneh

    46 Lectures 
     4 hours 

 GUHARAJANM

    6 Lectures 
     4 hours 

 Uplatz
 Print
 Add Notes
 Bookmark this page