A
linux runlevels determines the applications and services which should
be run at that time.
Level Introduction
0 Shutdown the
system
1/s/S Single user
mode – for recovery and maintenance.
2 Multiuser mode
with graphical interface.
3 Multiuser mode
with text login screen.
4 Can be
customized.
5 Multiuser mode
with graphical interface and networking.
6 Reboot the
system.
Note that for
ubuntu system you will not find any differences between runlevel 2,3
& 5.
You can check your
current runlevel of system by typing following command in your linux
terminal.
$ runlevel
N 2
Here first number
shows previous runlevel and second number shows current runlevel of
system.N shows there are no previous runlevels after system restored.
To change the
runlevel type
$ telinit 5
will
change the system runlevel to 5. To set default runlevel,open
'/etc/init/rc-sysinit.conf' and change the following line according to
your need.
env DEFAULT_RUNLEVEL=2
To shutdown the system you can type
$ shutdown -h 3
“message to broadcast”
will scheduled the
shutdown ( here option '-h' for halt )after 3 seconds with message
you have set for broadcast.
chkconfig - will list registered services and display their status at run level. You need to install that from repository if it is not available in your system.
You can check which services are executed when system enters in this runlevel at
/etc/rc0.d
/etc/rc1.d
....
....
/etc/rc6.d
If you want to
disable/enable any services which are running in this runlevel,you can
do so by just editing scripts name in that directory.For more
information you can refer 'README' document in same directory.