Initialize through the/etc/inittab File

Source: Internet
Author: User

Initialize through the/etc/inittab File

Init executes the corresponding script based on/etc/inittab for system initialization, such as setting the keyboard, Font, loading module, and network.

1./etc/rc. d/rc. sysinit

The init configuration file contains the following line:

si::sysinit:/etc/rc.d/rc.sysinit

RC. sysinit is the first script executed by init. It mainly performs system initialization. RC. sysinit is an important script to run at each running level. It mainly includes activating swap partitions, checking disks, loading hardware modules, and other tasks that require priority. /Etc/rc. d/rc. sysinit mainly completes the same initialization work in each running mode, including:

L set the initial $ PATH variable;
L configure the network;
L enable swap for virtual memory;
L set the Host Name of the system;
L check the root file system for necessary repairs;
L check the quota of the root file system;
L quota of users and groups opened for the root file system;
L reload the root file system in read/write mode;
L clear the mounted file system table/etc/mtab;
L input the root file system to the mtab;
L prepare the system for Loading modules;
L search for related files of the module;
L check the file system for necessary repairs;
L load all other file systems;
L clear/etc/mtab,/etc/fastboot, and/etc/nologin;
L Delete the lock file of uucp;
L Delete outdated subsystem files;
L Delete Obsolete PID files;
L set the system clock;
L activate swap partitions;
L initialize the serial port;
L load the module.

2./etc/rc. d/rcX. d/[Ks]

After RC. sysinit is executed, init is returned and the/etc/rc. d/RC program is executed. Taking runtime Level 5 as an example, init executes the following content in the configuration file inittab:

l5:5:wait:/etc/rc.d/rc 5

This line indicates running/etc/rc with 5 as the parameter. d/RC,/etc/rc. d/RC is a shell script that accepts 5 as the parameter and executes/etc/rc. d/rc5.d/All RC startup scripts in the directory,/etc/rc. the startup scripts in the D/rc5.d/directory are actually some link files, rather than the real RC startup scripts. The real RC startup scripts are all in the/etc/rc. d/init. d/directory. These RC boot scripts have similar usage. They generally accept parameters such as start, stop, restart, and status.

The rc startup script in/etc/rc. d/rc5.d/is usually a link file starting with K or S. The Startup Script starting with S runs with the start parameter. If you find that the corresponding script also has a K-header link and is in the running state (marked by a file under/var/lock/subsys ), stop the started daemon with the Stop parameter and run the daemon again. This is done to ensure that all related daemon will be restarted when init changes the running level.

You can use chkconfig to set which daemon will run at each running level. Common daemon processes are as follows.

L AMD: automatically installs the NFS daemon.
L apmd: Advanced Power Management daemon.
L arpwatch: records logs and builds a database with the ethernet address and IP address displayed on the LAN interface.
L autofs: the automatic installation and management process automount is related to NFS and relies on NIS.
L crond: the daemon for scheduled tasks in Linux.
L named: DNS server.
L netfs: Install NFS, Samba, and NetWare network file systems.
L Network: Activate the script program with configured network interfaces.
L NFS: Enable the NFS service.
L Portmap: RPC Portmap manager, which manages RPC-based connections.
L Sendmail: The Mail Server Sendmail.
L SMB: Samba file sharing/printing service.
L syslog: a script that enables Syslog and klogd system logs to wait for processes during system boot.
L XFS: X Window server, which provides a font set for local and remote X servers.
L xinetd: supports core daemon processes of multiple network services and manages services such as wuftp, sshd, and telnet.
After these daemon processes are started, the RC program is executed and the system returns init to continue the next step.

3. Run/etc/EC. d/rc. Local.

In RHEL 4, the Operating Modes 2, 3, and 5 put/etc/rc. d/RC. local is the last in the initialization script, so you can add some commands in this file that need to be executed after other initialization tasks and before logging on. When maintaining a Linux system, the system administrator needs to modify the script for starting or shutting down the system. If the modification takes effect only when boot is started, and the modification is not significant, you can simply edit the/etc/rc. d/rc. Local script. This command script program is executed at the last step of the boot process.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.