Search Engine

Loading

Sallar

Sallar
RedhatEnterpriseLinux Blog

How to Initialization Scripts in RHEL



Network services such as the Apache HTTP Server and DHCP along with other programs such as cron and syslog require a daemon to be running at all times. The daemon performs actions such as listening for connections to a service on specific ports, making sure commands are executed at specific times, and capturing data such as log messages when they are 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. An initialization 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 so that programs used at startup are loaded into memory before they are needed. Doing so decreases the amount of time it takes to start the system. When you boot 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. Refer to the later section “Runlevels” for details on how runlevels are configured. Lastly, the /etc/rc.d/rc.local script is executed. Commands can be added to this file for custom initialization.
The initialization scripts can also be used 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:
service <service> <action>
For example, the following starts the OpenSSH service:
service sshd start

0 comments:

Post a Comment

Powered by Blogger.

Ads

 
Copyright © Redhat Enterprise linux. Original Concept and Design by My Blogger Themes
My name is Abdul Razaq but people call me Raziq. Here is my home page: www.redhatenterpriselinux.blogspot.com I live in Quetta, Pakistan and work as an IT-Engineer.