Linux - (Init|Run) Level

Linux - (Init|Run) Level

About

The scripts running during boot and shut-down depends of a run level.

The scripts are found in the directory /etc/rc.d/rc#.d/ where the symbol # represents the run_level.

The run level “3” will run in the directory /etc/rc.d/rc3.d/ all the scripts which start with the letter:

  • S during system boot.
  • K during shutdown

This system provides an orderly way to bring the system to different states for production and maintenance modes.

Run Level

Runlevel Scripts Directory (Red Hat/Fedora Core) State
0 /etc/rc.d/rc0.d/ shutdown/halt system
1 /etc/rc.d/rc1.d/ Single user mode
2 /etc/rc.d/rc2.d/ Multiuser with no network services exported
3 /etc/rc.d/rc3.d/ runlevel “3” (often called console mode) is often used by servers which do not need a graphical user interface. Default text/console only start. Full multiuser
4 /etc/rc.d/rc4.d/ Reserved for local use. Also X-windows (Slackware/BSD)
5 /etc/rc.d/rc5.d/ Runlevel “5” will boot the system into GUI mode using XDM and X-Windows. XDM X-windows GUI mode (Redhat/System V)
6 /etc/rc.d/rc6.d/ Reboot
s or S Single user/Maintenance mode (Slackware)
M Multiuser mode (Slackware)

Management

Get

runlevel

OS init level

The OS Init level is promoted with the init command

[root prompt]# init 5.

Script init level with chkconfig

chkconfig provides a simple command-line tool for maintaining the /etc/rc[0-6].d directory hierarchy by relieving system administrators of the task of directly manipulating the numerous symbolic links in those directories.

chkconfig - updates and queries runlevel information for system services chkconfig provides a simple command-line tool for maintaining the /etc/rc[0-6].d directory hierarchy by relieving system administrators of the task of directly manipulating the numerous symbolic links in those directories.

Script Services Config (Run Level, Start and Kill Position)

Each service which should be manageable by chkconfig needs two or more commented lines added to the header of the init.d script.

#!/bin/bash
# chkconfig: 345 95 20

This will instruct chkconfig to add the service:

  • to the runlevels 3, 4 and 5,
  • with a start position of 95 and a kill position of 20.

List state and run level of all services which can be started by init

To get a list state and run level of all services which can be started by init

chkconfig --list
NetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:off
acpid           0:off   1:off   2:on    3:on    4:on    5:on    6:off
anacron         0:off   1:off   2:on    3:on    4:on    5:off   6:off
apmd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
atd             0:off   1:off   2:off   3:on    4:on    5:on    6:off
auditd          0:off   1:off   2:on    3:on    4:on    5:on    6:off
autofs          0:off   1:off   2:off   3:on    4:on    5:on    6:off
avahi-daemon    0:off   1:off   2:off   3:on    4:on    5:on    6:off
avahi-dnsconfd  0:off   1:off   2:off   3:off   4:off   5:off   6:off
bluetooth       0:off   1:off   2:on    3:on    4:on    5:off   6:off
capi            0:off   1:off   2:off   3:off   4:off   5:off   6:off
conman          0:off   1:off   2:off   3:off   4:off   5:off   6:off
cpuspeed        0:off   1:on    2:on    3:on    4:on    5:on    6:off
crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off
cups            0:off   1:off   2:on    3:on    4:on    5:off   6:off
dnsmasq         0:off   1:off   2:off   3:off   4:off   5:off   6:off
dund            0:off   1:off   2:off   3:off   4:off   5:off   6:off
...................

Script init level Manually

Do it with chkconfig

To be able to start a script on all init level, symbolic links should be placed in /etc/rc[0-6].d:

  • /etc/rc.d/rc0.d,
  • /etc/rc.d/rc1.d,
  • /etc/rc.d/rc2.d,
  • /etc/rc.d/rc3.d,
  • /etc/rc.d/rc5.d,
  • /etc/rc.d/rc6.d

Documentation / Reference





Discover More
Weblogic Endeca Server Application
Endeca - Server (MDEX engine)

Oracle Endeca Server starts up (the default port is 7770) and is completely running when you see the STARTING message displayed in the output window. You can find out in the script the following java...
Linux - (Init|Run) Level

Linux - (Init|Run) Level The scripts running during boot and shut-down depends of a run level. The scripts are found in the directory /etc/rc.d/rc#.d/ where the symbol # represents the . The run...
Linux - (init.d|Initialization) Location

The (init.d|Initialization) directory contains start/stop scripts used during the OS initialization phase. Everything from acpid to x11-common is controlled from this directory. Location Os Tip /etc/rc.d/init.d/...
Linux - Inittab (/etc/inittab)

System V init examines the /etc/inittab file for an :initdefault: entry, which tells init whether there is a default runlevel. If there is no default runlevel, then the user is dumped to a system console,...
Linux - init process (Sysv ?)

Init is the first daemon process that continues running until the system is shut down. Init is typically assigned process identifier 1. The init command permits to promote an init level in order...
12g Obiee Standard Topology
OBIEE - 12.2.1.3 - Linux Installation 12C on Azure

An installation procedure: on a Azure VM Linux. with an Oracle Database with a standard topology (ie a WebLogic Server domain that contains an Administration Server and a cluster that contains two...
Card Puncher Data Processing
Oracle Database - Automating Shutdown and Startup on Linux

Automating database startup and shutdown guards against incorrect database shutdown. Since the version 11.2, it's recommended to use Oracle Restart but a single database installation doesn't install it....



Share this page:
Follow us:
Task Runner