Initialization Scripts

Network services like the Apache HTTP Server and DHCP(Dynamic Host Configuration Protocol )  along with other programs such as cron ( Enables users to schedule jobs to run automatically at a certain time and date, used in administration, connecting to internet and downloading e-mail) and syslog require a daemon to be running at all times. The daemon performs actions like listening for connections for a service on specific ports, making sure commands are executed at specific times, and capturing data such as log messages sent out by other programs.

Programs that require a daemon to be started have an initialization script in the /etc/rc.d/init.d/ directory. This script can also be used to run a command at boot time such as the readahead_early and readahead_later scripts, which run the readahead utility which loads the programs used at startup into memory before they are needed. It decreases the amount of time it takes to start the system. While booting a Red Hat Enterprise Linux system, the init program is run last in the kernel boot process. This program first executes the /etc/rc.d/rc.sysinit script to perform actions such as loading kernel modules for hardware support, loading the default keymap, and setting the hostname. The /etc/inittab script is run next, which then tells init which runlevel to start. The runlevel defines which services to start at boot time, or which initialization scripts to execute.

Lastly, the /etc/rc.d/rc.local script is executed. Commands can be added to this file for custom initialization. The initialization scripts enables user to start, stop, and restart services after the system has booted. These actions are performed with the service command as the root user. Each script has its own list of actions. Common actions defined include start, stop, conrestart (which stops and starts the service only if it is already running), and status.

To perform an action, use the following syntax:


For example, the following starts the OpenSSH service:  

service sshd start


0 Responses to "Initialization Scripts"

Post a Comment


Managing Shell And its Secrets

Subscribe To Get Update On Mobile

Get updates of latest post on your mobile free