Wednesday, October 1, 2008

Changing RunLevel in Linux

When a Linux system is booted, the first process that the kernel starts is /sbin/init. It is always process id (PID) 1 and has a parent process id (PPID) of 0. The init process is always running.
The /etc/inittab file is the configuration file for /sbin/init. /etc/inittab identifies the processes that init starts, and it can be customized as desired. Few environment variables are set when a process is started by init.
The inittab lines have four colon-separated fields:

id:runlevel:action:command

Let's look at the meaning of each.
(i). id The inittab id consists of one to four characters that identify the inittab line. The id must be unique.
(ii). runlevels The runlevels field contains one or more characters, usually numbers identifying the runlevels for which this process is started.
  • 0 System Halt
  • 1 Single user mode
  • 2 Local multiuser without remote network (e.g., NFS)
  • 3 Multiuser with network
  • 4 Not used
  • 5 Multiuser with network and xdm
  • 6 System reboot
You can change runlevel by changing this field, to the number
you want. And reboot the machine.

No comments: