Red Hat [Electronic resources] : The Complete Reference Enterprise Linux Fedora Edition؛ The Complete Reference نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Red Hat [Electronic resources] : The Complete Reference Enterprise Linux Fedora Edition؛ The Complete Reference - نسخه متنی

Richard L. Petersen

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








System Startup Files: /etc/rc.d and /etc/sysconfig


Each time you start your system, it reads a series of startup commands from system initialization files located in your

/etc/rc.d directory. These initialization files are organized according to different tasks. Some are located in the

/etc/rc.d directory itself, while others are located in a subdirectory called

init.d . You should not have to change any of these files. The organization of system initialization files varies among Linux distributions. The Red Hat organization is described here. Some of the files you find in

/etc/rc.d are listed in Table 20-1.


/etc/rc.d/rc.sysinit


The

/etc/rc.d/rc.sysinit file holds the commands for initializing your system, including the mounting and unmounting of your file systems. Kernel modules for specialized features or devices can be loaded in an

rc.modules file. The

/etc/rc.d/rc.local file is the last initialization file executed. You can place commands of your own here. When you shut down your system, the system calls the

halt file, which contains shutdown commands. The files in

init.d are then called to shut down daemons, and the file systems are unmounted. In the current distribution of Red Hat,

halt is located in the

init.d directory.


/etc/rc.d/init.d


The

/etc/rc.d/init.d directory is designed primarily to hold scripts that start up and shut down different specialized daemons, such as network and printer daemons and those for font and Web servers. These files perform double duty, starting a daemon when the system starts up and shutting down the daemon when the system shuts down. The files in

init.d are designed in a way to make it easy to write scripts for starting up and shutting down specialized applications. They use functions defined in the

functions file. Many of these files are set up for you automatically. You shouldn't need to change them. If you do change them, be sure you know how these files work first.
















































Table 20-1: System Startup Files


File


Description


/etc/sysconfig


Directory that holds system configuration files and directories.


/etc/rc.d


Directory that holds system startup and shutdown files.


/etc/rc.d/rc.sysinit


Initialization file for your system.


/etc/rc.d/rc.local


Initialization file for your own commands; you can freely edit this file to add your own startup commands; this is the last startup file executed.


/etc/rc.d/rc.modules


Loads kernel modules (not implemented by default on Red Hat Linux).


/etc/rc.d/init.d


Directory that holds network scripts to start up network connections.


/etc/rc.d/rc

num

.d


Directories for different runlevels, where

num is the runlevel. The directories hold links to scripts in the

/etc/rc.d/init.d directory.


/etc/rc.d/init.d/halt


Operations performed each time you shut down the system, such as unmounting file systems; called

rc.halt in other distributions.


/etc/rc.d/init.d/cups


Start up and shut down the

cups printer daemon.


/etc/rc.d/init.d/xinetd


Operations to start up or shut down the

xinetd daemon.


/etc/rc.d/init.d/network


Operations to start up or shut down your network connections.


/etc/rc.d/init.d/httpd


Operations to start up or shut down your Web server daemon,

httpd .


When your system starts up, several programs are automatically started and run continuously to provide services, such as a Web site or print servers. Depending on what kind of services you want your system to provide, you can add or remove items in a list of services to be started automatically. For example, the Web server is run automatically when your system starts up. If you are not hosting a Web site, you would have no need for the Web server. You could prevent the service from starting, removing an extra task the system does not need to perform, freeing up resources and possibly reducing potential security holes. Several of the servers and daemons perform necessary tasks. The

sendmail server enables you to send messages across networks, and the

cupsd server performs printing operations.

To configure a service to start up automatically at boot, you can use the redhat-config- services tool available on the desktop or the

chkconfig tool, which is run at a command line. redhat-config-services displays a list of available services, letting you choose the ones you want to start or prevent from starting. The

chkconfig command uses the

on and

off options to select and deselect services for startup at boot (see section on

chkconfig later in this chapter).

chkconfig httpd on

To start and stop services manually at any time, you can use either redhat-config-services or the

service command. With the

service command, you list the service with the

stop argument to stop it, the

start argument to start it, and the

restart argument to restart it.

service httpd start





Tip

When your system starts up, it uses links in special runlevel directories in the

/etc/rc.d/ directory to run the startup scripts in the

/etc/rc.d/init.d directory. A runlevel directory bears the number of its runlevel, as in

/etc/rc.d/rc3.d for runlevel 3, and

/etc/rc.d/rc5.d for runlevel 5. To prevent a service from starting up, remove its link from that runlevel directory, or change the first letter in the name of the link from S to K.



/ 328