Customizing the Linux bootup and shutdown processes

转载 2016年08月30日 09:44:48

Customizing the Linux bootup and shutdown processes

This Drill Down covers the init program, and the files and directories init<I> </I>uses to configure a Linux system for any run-level. It also covers adding and removing services from system run-levels so you can customize bootup and shutdown like a pro.

<iframe frameborder="0" src="http://tpc.googlesyndication.com/safeframe/1-0-4/html/container.html#xpc=sf-gdn-exp-1&amp;p=http%3A//www.techrepublic.com" id="google_ads_iframe_/8264/asia-techrepublic/open-source_3" title="3rd party ad content" name="1-0-4;63489;<div id=adunit data-rh-set-type=&quot;0&quot;><div id=ads ><ul><li id=taw0 class=&quot;taw taw0 separator&quot; lang=&quot;en&quot;><div class=&quot;rh&quot;><table><tr><td class=&quot;rh0c&quot;><div class=&quot;rh0&quot;><table><tr><td class=&quot;rh00c&quot;><div class=&quot;rh-box-title rh-title rh00 collapsed-box&quot;><a target=_blank class=&quot;rhtitle rhdefaultcolored&quot; href=&quot;http://www.googleadservices.com/pagead/aclk?sa=L&amp;ai=CTMcKuILCV_WsEI6NogPgqraYD4XnstFFycaOw0_AjbcBEAEg3vrCFSgCYJ3p1YG4BaABp__52APIAQGpAhmnbl1bx7I-4AIAqAMByAObBKoEzwFP0F6CY2mmlNh1dKegZlsflu5Ow88S6cwffJxHAq4CoXxaLs7uqJg_WOskP9nDlIH_juoVSxLEMfyeIBmqhbKNFpK7rPFbDv8FmMMLRsCnCXl7fasddFn2QdEgqedsDOzy6OpmmBquTcQRrbIp8-unNv77hB_BDskpTffHNS514VPZvrsCs4WS_MOs9HpDa8a0D97_c3IH7HHsk_HI79vLOhgpcLF-pN4Fv6XfabbxL2pEtg7-olHwh7JtdoD37rHlJ_E06PAo7x0QFtuJTF7gBAGIBgGAB8GAhieoB4HGG6gHpr4b2AcB2BMB&amp;num=1&amp;cid=CAASEuRo9rz4qAQX-mEBDA6UrMWirA&amp;sig=AOD64_1_V_SHAgrPHV0vMwh8KqCi_e60ow&amp;client=ca-pub-2679103605715789&amp;adurl=http://simplex-software.fr&quot; target=_blank title=&quot;www.simplex-software.fr&quot;><span>Simplex Software</span></a></div></td></tr><tr><td class=&quot;rh01c&quot;><div class=&quot;rh-box-url rh-url rh01&quot;><div class=&quot;rhurlctr rhdefaultcolored rhurlctr_nowrap rhurlctr_clickable&quot; dir=&quot;ltr&quot;><a target=_blank class=&quot;rhurl rhdefaultcolored&quot; title=&quot;simplex-software.fr&quot; href=&quot;http://www.googleadservices.com/pagead/aclk?sa=L&amp;ai=CTMcKuILCV_WsEI6NogPgqraYD4XnstFFycaOw0_AjbcBEAEg3vrCFSgCYJ3p1YG4BaABp__52APIAQGpAhmnbl1bx7I-4AIAqAMByAObBKoEzwFP0F6CY2mmlNh1dKegZlsflu5Ow88S6cwffJxHAq4CoXxaLs7uqJg_WOskP9nDlIH_juoVSxLEMfyeIBmqhbKNFpK7rPFbDv8FmMMLRsCnCXl7fasddFn2QdEgqedsDOzy6OpmmBquTcQRrbIp8-unNv77hB_BDskpTffHNS514VPZvrsCs4WS_MOs9HpDa8a0D97_c3IH7HHsk_HI79vLOhgpcLF-pN4Fv6XfabbxL2pEtg7-olHwh7JtdoD37rHlJ_E06PAo7x0QFtuJTF7gBAGIBgGAB8GAhieoB4HGG6gHpr4b2AcB2BMB&amp;num=1&amp;cid=CAASEuRo9rz4qAQX-mEBDA6UrMWirA&amp;sig=AOD64_1_V_SHAgrPHV0vMwh8KqCi_e60ow&amp;client=ca-pub-2679103605715789&amp;adurl=http://simplex-software.fr&quot; target=&quot;_blank&quot;><span>simplex-software.fr</span></a></div></div></td></tr><tr><td class=&quot;rh02c&quot;><div class=&quot;rh02&quot;><table><tr><td class=&quot;rh021c&quot;><div class=&quot;rh-body rh-box-body rh021&quot;><span class=&quot;rhbody rhdefaultcolored&quot;>Software Architecture, Design &amp;amp; Dev SOA, BPM, ESB, JBoss, Oracle Fusion</span></div></td></tr></table></div></td></tr></table></div></td></tr></table></div></li><li id=taw1 class=&quot;taw taw1&quot; lang=&quot;en&quot;><div class=&quot;rh&quot;><table><tr><td class=&quot;rh0c&quot;><div class=&quot;rh0&quot;><table><tr><td class=&quot;rh00c&quot;><div class=&quot;rh-box-title rh-title rh00 collapsed-box&quot;><a target=_blank class=&quot;rhtitle rhdefaultcolored&quot; href=&quot;http://www.googleadservices.com/pagead/aclk?sa=L&amp;ai=CSOoBuILCV_WsEI6NogPgqraYD9qWxJZE9POMyakD_b7p8wMQAiDe-sIVKAJgnenVgbgFoAG0-f3gA8gBAeACAKgDAcgDmwSqBNUBT9BuhV5ppZTYdXSnoGZbH5buTsPPEunMH3ycRwKuAqF8Wi7O7qiYP1jrJD_Zw5SB_47qFUsSxDH8niAZqoWyjRaSu6zxWw7_BZjDC0bApwl5e32rHXRZ9kHRIKnnbAzs8ujqZpgark3EEa2yKfPrpzb--4QfwQ7JKU33xzUudeFT2b67ArOFkvzD5PTiB7Lhlg8IfIcj3tpM7ZHxy0vvQgC1GgCxJq6mA6qlNSpWtC9qxvYOvqJRcAe6bXaA92635Rr2NTr7KjcZ8cIfds52zpzIOwoF4AQBiAYBgAe0hoIfqAeBxhuoB6a-G9gHAdgTAg&amp;num=2&amp;cid=CAASEuRo9rz4qAQX-mEBDA6UrMWirA&amp;sig=AOD64_3dmUPBglBF2W79LPSErM--5TEYkA&amp;client=ca-pub-2679103605715789&amp;adurl=http://pages.zerto.com/Zerto-for-Data-Protection-and-Recovery.html%3Fzsource%3DAdwords%26zcid%3D701F0000000uQDkIAM&quot; target=_blank title=&quot;www.zerto.com&quot;><span>Zerto Virtual Replication</span></a></div></td></tr><tr><td class=&quot;rh01c&quot;><div class=&quot;rh-box-url rh-url rh01&quot;><div class=&quot;rhurlctr rhdefaultcolored rhurlctr_nowrap rhurlctr_clickable&quot; dir=&quot;ltr&quot;><a target=_blank class=&quot;rhurl rhdefaultcolored&quot; title=&quot;zerto.com&quot; href=&quot;http://www.googleadservices.com/pagead/aclk?sa=L&amp;ai=CSOoBuILCV_WsEI6NogPgqraYD9qWxJZE9POMyakD_b7p8wMQAiDe-sIVKAJgnenVgbgFoAG0-f3gA8gBAeACAKgDAcgDmwSqBNUBT9BuhV5ppZTYdXSnoGZbH5buTsPPEunMH3ycRwKuAqF8Wi7O7qiYP1jrJD_Zw5SB_47qFUsSxDH8niAZqoWyjRaSu6zxWw7_BZjDC0bApwl5e32rHXRZ9kHRIKnnbAzs8ujqZpgark3EEa2yKfPrpzb--4QfwQ7JKU33xzUudeFT2b67ArOFkvzD5PTiB7Lhlg8IfIcj3tpM7ZHxy0vvQgC1GgCxJq6mA6qlNSpWtC9qxvYOvqJRcAe6bXaA92635Rr2NTr7KjcZ8cIfds52zpzIOwoF4AQBiAYBgAe0hoIfqAeBxhuoB6a-G9gHAdgTAg&amp;num=2&amp;cid=CAASEuRo9rz4qAQX-mEBDA6UrMWirA&amp;sig=AOD64_3dmUPBglBF2W79LPSErM--5TEYkA&amp;client=ca-pub-2679103605715789&amp;adurl=http://pages.zerto.com/Zerto-for-Data-Protection-and-Recovery.html%3Fzsource%3DAdwords%26zcid%3D701F0000000uQDkIAM&quot; target=&quot;_blank&quot;><span>zerto.com</span></a></div></div></td></tr><tr><td class=&quot;rh02c&quot;><div class=&quot;rh02&quot;><table><tr><td class=&quot;rh021c&quot;><div class=&quot;rh-body rh-box-body rh021&quot;><span class=&quot;rhbody rhdefaultcolored&quot;>The premiere BC/DR Solution. Cost effective &amp;amp; less downtime</span></div></td></tr></table></div></td></tr></table></div></td></tr></table></div></li></ul></div><div class=ads_chrome_top></div><div class=ads_chrome_bottom></div><div class=ads_chrome_left></div><div class=ads_chrome_right></div></div><div id=abgc class=abgc dir='ltr'><div id=abgb class=&quot;abgb&quot;></div><div id=abgs class=abgs><a target=_blank id=abgl class=abgl href=&quot;https://www.google.com/url?ct=abg&amp;amp;q=https://www.google.com/adsense/support/bin/request.py%3Fcontact%3Dabg_afc%26url%3Dhttp://www.techrepublic.com/article/customizing-the-linux-bootup-and-shutdown-processes/%26gl%3DCN%26hl%3Den%26client%3Dca-pub-2679103605715789%26ai0%3DCTMcKuILCV_WsEI6NogPgqraYD4XnstFFycaOw0_AjbcBEAEg3vrCFSgCYJ3p1YG4BaABp__52APIAQGpAhmnbl1bx7I-4AIAqAMByAObBKoEzwFP0F6CY2mmlNh1dKegZlsflu5Ow88S6cwffJxHAq4CoXxaLs7uqJg_WOskP9nDlIH_juoVSxLEMfyeIBmqhbKNFpK7rPFbDv8FmMMLRsCnCXl7fasddFn2QdEgqedsDOzy6OpmmBquTcQRrbIp8-unNv77hB_BDskpTffHNS514VPZvrsCs4WS_MOs9HpDa8a0D97_c3IH7HHsk_HI79vLOhgpcLF-pN4Fv6XfabbxL2pEtg7-olHwh7JtdoD37rHlJ_E06PAo7x0QFtuJTF7gBAGIBgGAB8GAhieoB4HGG6gHpr4b2AcB2BMB%26ai1%3DCSOoBuILCV_WsEI6NogPgqraYD9qWxJZE9POMyakD_b7p8wMQAiDe-sIVKAJgnenVgbgFoAG0-f3gA8gBAeACAKgDAcgDmwSqBNUBT9BuhV5ppZTYdXSnoGZbH5buTsPPEunMH3ycRwKuAqF8Wi7O7qiYP1jrJD_Zw5SB_47qFUsSxDH8niAZqoWyjRaSu6zxWw7_BZjDC0bApwl5e32rHXRZ9kHRIKnnbAzs8ujqZpgark3EEa2yKfPrpzb--4QfwQ7JKU33xzUudeFT2b67ArOFkvzD5PTiB7Lhlg8IfIcj3tpM7ZHxy0vvQgC1GgCxJq6mA6qlNSpWtC9qxvYOvqJRcAe6bXaA92635Rr2NTr7KjcZ8cIfds52zpzIOwoF4AQBiAYBgAe0hoIfqAeBxhuoB6a-G9gHAdgTAg&amp;amp;usg=AFQjCNHM51X47oMlamCZTxke30E9az5YVg&quot; target=_blank></a></div></div><img class=&quot;abg_cn&quot; src=&quot;http://static.googleadsserving.cn/pagead/images/cn/ad_aeaeae_065.svg&quot; /><iframe scrolling=&quot;no&quot; frameborder=0 height=0 width=0 src=&quot;http://cm.g.doubleclick.net/push?client=ca-pub-2679103605715789&quot; style=&quot;position:absolute&quot;></iframe> {"uid":1,"hostPeerName":"http://www.techrepublic.com","initialGeometry":"{\"windowCoords_t\":0,\"windowCoords_r\":1600,\"windowCoords_b\":860,\"windowCoords_l\":0,\"frameCoords_t\":457,\"frameCoords_r\":1155.5,\"frameCoords_b\":547,\"frameCoords_l\":427.5,\"styleZIndex\":\"auto\",\"allowedExpansion_t\":457,\"allowedExpansion_r\":427.5,\"allowedExpansion_b\":228,\"allowedExpansion_l\":427.5,\"xInView\":1,\"yInView\":1}","permissions":"{\"expandByOverlay\":false,\"expandByPush\":false,\"readCookie\":false,\"writeCookie\":false}","metadata":"{\"shared\":{\"sf_ver\":\"1-0-4\",\"ck_on\":1,\"flash_ver\":\"22.0.0\"}}","reportCreativeGeometry":false,"isDifferentSourceWindow":false}" scrolling="no" marginwidth="0" marginheight="0" width="728" height="90" data-is-safeframe="true" style="border-width: 0px; border-style: initial; vertical-align: bottom;">

The ability to manage the Linux bootup and shutdown processes is essential for a system administrator. The administrator must know which services are running on the system, how to add new services, and how to remove services that are not required. This Daily Drill Down will provide Linux administrators with the information necessary to customize the files and directories involved in the Linux bootup and shutdown processes and will examine the tools available to customize these processes.

An overview of the boot process
When a Linux system is booted, the Linux boot loader (LILO) loads the kernel. When called by LILO, the kernel is uncompressed, the display device is initiated, and the kernel starts checking for hardware attached to your system. As it finds hardware devices, it loads kernel modules to provide support for these devices. Once hardware support is loaded, the kernel mounts the root (/) filesystem as read-only. If no problems are detected in /, the root filesystem is mounted as read-write.

After the root filesystem is mounted as read-write, the kernel executes a program called init. When init has completed its execution, the system is up and running. The init process is highly configurable, via the /etc/inittab file and files and directories with the init configuration process.

The following syntax is used for configuration lines in the /etc/inittab file:
id:run-levels:action:process [arguments]
  • The first field is a unique label, which identifies an entry in the inittab file.
  • The second field specifies which run-levels this entry applies to.
  • The third field specifies the action to be taken.
  • The fourth field identifies the process to be run and any arguments that apply to that process. Command-line arguments may also be specified in the fourth field.

The state of a Linux system is specified by its run-level. There are seven run-levels available on a Linux system.
  1. 0—Halt (Do not set initdefault to this run-level.)
  2. 1—Single-user mode
  3. 2—Multiuser—with no networking support
  4. 3—Full multiuser mode—with networking support
  5. 4—Unused
  6. 5—X11—with multiuser and networking support
  7. 6—Reboot (Do not set initdefault to this run-level.)

It’s possible to specify multiple run-levels in the same init configuration line. For example, to specify a configuration for both run-level 1 and run-level 3, use the following syntax:
id:13:action:process [arguments].

Table A lists the possible actions for system run-levels.

Table A
Action Description
   
respawn The process is restarted whenever it terminates.
wait The process is run once, and init waits until it terminates.
once The process is run once.
boot The process is run during system boot, regardless of the run-level.
bootwait The process is run during system boot, and init waits for the
  process to terminate.
off No action is taken. Used to disable a configuration line without
  removing it. May be used instead of a comment (#).
ondemand Normally not used.
initdefault Specifies the default run-level for the system. The process filed is
  ignored.
sysinit The process is run once during system boot. A sysinit action takes
  precedence over boot or bootwait actions.
powerwait Run when init receives a SIGPWR signal. An uninterruptible power
  supply (UPS) will issue the SIGPWR signal when a power problem
  Is detected. When the SIGPWR signal is issued, init will wait until
  the process terminates.
powerfail Same as powerwait, but init does not wait for the process to
  terminate.
powerokwait Run when init receives a SGIPWR signal and the /etc/powerstatus
  file contains the text string OK. This file is normally created by the
  UPS monitoring software and is used to indicate that the power
  problem is corrected.
ctrlaltdel Run when init receives a SIGINT signal.
kbrequest Run when init receives a keyboard signal from the keyboard handler.
Possible actions for system run-levels.

The /etc/rc.d/rc.sysinit script
When a Linux system is booted, the kernel runs init, which in turn runs the/etc/rc.d/rc sysinit script. This script is run before any other actions are taken because of the following line in the /etc/inittab file:
si::sysinit: /etc/rc.d/rc.sysinit

The run-level field in this line is empty because init recognizes sysinit as a system initialization action. The rc.sysinit performs several tasks, including setting the hostname, enabling the swap partition, checking filesystems, and loading kernel modules. Normally, you will not have to modify the /etc/rc.sysinitscript.

The /etc/rc.d/rc script
When init is told to change to one of the seven possible run-levels, a script specified in one of the following seven lines in the /etc/inittab file is run:
l0:0:wait:/etc/rc.d/rc 0
l1:1:wait:/etc/rc.d/rc 1
l2:2:wait:/etc/rc.d/rc 2
l3:3:wait:/etc/rc.d/rc 3
l4:4:wait:/etc/rc.d/rc 4
l5:5:wait:/etc/rc.d/rc 5
l6:6:wait:/etc/rc.d/rc 6


For each run-level [0-6], a script named /etc/rc.d/rc is run, with the run-level used as the argument to the script. This script is used to start and stop all services in the specified run-level. For example, if init is told to change the run-level to 5, the /etc/rc.d/rc script will be run with an argument of 5 in a command-line like the following:
/etc/rc.d/rc 3

The rc script performs a three-step process:
  1. It checks to ensure that a subdirectory exists for the specified run-level. If the script is run with an argument of 5, it will make sure that the /etc/rc.d/rc5.d subdirectory exists. If this directory exists, the script continues to the next step. If this directory does not exist, the run-level is not changed.
  2. It determines whether any of the programs (often called services orprocesses) that are supposed to run in the specified run-level are already running. If a service is already running, the script will kill it so that the service may be started in the next step.
  3. Any script with the K argument is stopped and restarted, and any script with the S argument is started.

A typical /etc/rc.d/rc5.d file is shown below. This example shows an abbreviated version of the /etc/rc.d/rc.5 directory on my Red Hat 6.0 system. The listing shows the services that are to be started or stopped and the symbolic link to the scripts in the /etc/rc.d/init.d directory.
lrwxrwxrwx 1 root root 16 May 21 12:54 K08autofs -> ../init.d/autofs
lrwxrwxrwx 1 root root 15 May 21 12:54 K15httpd -> ../init.d/httpd
lrwxrwxrwx 1 root root 18 May 21 12:54 S75keytable -> ../init.d/keytable
lrwxrwxrwx 1 root root 13 May 21 12:54 S85gpm -> ../init.d/gpm


Note that the scripts in the /etc/rc.d/init.d directory are linked in two ways. Some are linked with the syntax
K[two-digit number] script-name

while others use the syntax
S[two-digit number] script-name

The scripts beginning with S are started, and the scripts beginning with K are stopped and then restarted if necessary. The two-digit specifies the order of execution for these services, with the lowest numbered services being executed first. In the above example, the script K08autofs is executed before the service K15httpd. Once the rc script is finished, the processing required forinit is also finished, and the system becomes available in the specified run-level.

The /etc/rc.d/init.d directory
The /etc/rc.d/init.d directory is used to hold all the scripts needed by all run-levels. Each script in this directory is used to start or stop a particular service.

All the scripts in this directory use a command-line syntax. For example, to start the ipchains service, which is a program used to configure a Linux firewall, the following script would be run:
/etc/rc.d/init.d/ipchains start

And to stop the ipchains service, use this command:
/etc/rc.d/init.d/ipchains stop

All scripts in the /etc/rc.d/init.d directory used start and stop as arguments to start or terminate a service. These scripts are read via symbolic links to the /etc/rc[0-6] directories.

The /etc/rc.d/rc.local script
The /etc/rc.d/rc.local script is run once at the end of run-levels 2, 3, and 5. Any command or script that needs to be run once per boot may be added to this file.

The /etc/rc.d/rc.serial script
The /etc/rc.d/rc.serial script is typically run once at the end of run-level 3 or 5 to initialize serial ports.

Booting up your system
During boot up, init first runs the rc.sysinit script and then runs the script for the default run-level. The default run-level is set in the /etc/inittab file with an entry similar to the example shown here:
id:3:initdefault:

In this example, the default is set to 3. This means that init will run the script required to put the system in multiuser mode, with networking support. The section following the default run-level setting contains a line specifying what needs to be done to change to each run-level. For run-level 3, the scripts in the /etc/rc.d/rc3.d directory that begin with S will be run. The rc script will also provide a start command to each script that begins with S. When all of these scripts are run, the rc script will finish and the system will be available in the specified run-level.

Overriding the default run-level
The default run-level for a Linux system may be overridden at the LILO prompt. The syntax for this command is
[label] [run-level]

For example, to boot my system to single-user mode, instead of the default run-level 3, I would use the command
linux single

or the command
linux 1

By using this command with the appropriate run-level, the default run-level is overridden.

Shutting down the system
The easiest way to shut down a Linux system is to enter the desired run-level in the command line. For example, the command
init linux 0 

will shut down the system. However, this command does not inform users that the system is about to be halted, and they will be unable to save any files they have open. A more practical way to shut down the system is to use theshutdown command. The shutdown command broadcasts a message to all users that the run-level is about to change. The shutdown command also allows the administrator to schedule the shutdown command. The shutdowncommand tells init to change the current run-level by using either the halt orboot command.

Some examples are shown in Table B.

Table B
Command Action
shutdown -r now Shuts down and reboots now.
shutdown -h 5 Shuts down and halts the system in five minutes.
shutdown -k 5 Does not shut down but sends broadcast message to users.
shutdown -c Cancels a running shutdown.
Shutdown command examples.

Disabling logins during shutdown
Users are able to log in during a shutdown countdown period. To prevent users from logging in during this period, create a text file called /etc/nologin, with an appropriate message stating that a shutdown is in progress and that logins are disabled. After this file is created, add the command
rm -f /etc/nologin 

to the /etc/rc.local script, and make sure that it is run by init at the end of run-level 3.

Giving users permission to run shutdown
In its default configuration, the /etc/inittab file gives any user the ability to reboot a Linux server using the [Ctrl][Alt][Delete] key combination. The following line in /etc/inittab allows this action:
ca::ctrlaltdel: /sbin/shutdown -t3 -r now

This line allows the [Ctrl][Alt][Delete] key combination to be used for rebooting and calls the shutdown script to reboot immediately. To disable this function, add a comment (#) to this line or remove it from the /etc/inittab file. To give specific users permission to use the shutdown script, create the/etc/shutdown.allow file.

The /etc/shutdown.allow file is a text file that contains one username per line. Each user named in this file is allowed to use the shutdown command.

Dealing with power failures
Eventually, you’ll have to deal with a power failure on your system. My first concern when faced with a power failure is to make sure that my servers are shut down properly. This ensures that file systems are unmounted properly and that data contained in buffers is properly written to the hard disk. The default /etc/inittab file contains the following line:
pf::powerfail: /sbin/shutdown -f -h +2 "Power failure; System Shutting Down"

This line tells init to run shutdown in the event of a power failure. The powerfailaction is enabled when the monitoring software on the Uninterruptible Power Supply (UPS), or powerd, the power-monitoring daemon, send the SIGPWRsignal to init. The default setting allows the UPS to run the system for two minutes prior to running the shutdown script.

If power is restored during the shutdown process, the following line cancels the running shutdown:
pr:12345:powerokwait:/sbin/shutdown -c "Power Restored. Shutdown Cancelled"

When init receives a SIGPWR signal and the file /etc/powerstatus contains the text string OK, the powerok action is activated.

Managing init files
The System V init program uses numerous files, symbolic links, and directories. Fortunately, Linux includes three tools for managing init files:
  • chkconfig
  • ntsysv
  • linuxconf

Using chkconfig
The chkconfig utility allows the administrator to maintain the symbolic links required for starting and stopping services in a run-level; chkconfig can manage all scripts in the /etc/rc.d/init.d directory. Following are some typical uses for chkconfig.

List manageable services
To list what services will start in each run level, use the command
/sbin/chkconfig —list

To check the run-level configuration for a particular service, use the command
/sbin/chkconfig —list inet

The preceding command lists the configuration for the inet service in each run-level. This command produces the following on my system:
inet 0:off 1:off 2:off 3:on 4:on 5:on 6:off

The output tells me that the inet service is enabled for run-levels 3 and 5 and is disabled for all other run-levels.

Add a new service
To make a new service available to the current run-level, run the following command:
chkconfig —add httpd

This command adds the httpd service to the current run-level.

To add a new service to a specific run-level, use the command
/sbin/config —level 4 —add inet

This command adds the inet service to run-level 4.

Delete a service
To remove a service from the current run-level, use the command
/sbin/chkconfig —del inet

This command deletes the inet service from the current run-level.

To delete a service from a specific run-level, use the command
/sbin/chkconfig —del gated —level 5

This command removes the gated service from run-level 5.

Using ntsysv
The ntsysv utility allows service management through a simple menu interface. To run ntsysv for the current run-level, use the command
/usr/sbin/ntsysv

Select the services you’d like to start in the current run-level and click OK.

To run ntsysv for a specific run-level, use the command
/usr/sbin/ntsysv —level 

For example, to run ntsyscv for run-level 4, use the command
/usr/sbin/ntsysv —level 4

Select the services you’d like started for the specified run-level and click OK.

Using linuxconf
To use linuxconf to manage init files, follow these steps:
  1. From the command line, type linuxconf.
  2. Select Control | Control Panel | Control Service.
  3. Enable or disable the appropriate services.
  4. Accept the changes.
  5. Activate the changes prior to quitting linuxconf.

Conclusion
In this Daily Drill Down, I covered the bootup and shutdown procedures for a Linux system. I also explained the init program and the files and directories that init depends upon to configure a Linux system for any run-level. Finally, I showed you how to add and remove services from Linux system run-levels and discussed the tools available on a Linux system to manage init files.

关闭数据库遇到SHUTDOWN: Active processes prevent shutdown operation

关闭数据库遇到SHUTDOWN: Active processes prevent shutdown operation
  • q947817003
  • q947817003
  • 2015年12月13日 19:39
  • 1010

SHUTDOWN: Active processes prevent shutdown operation

在使用shutdown immediate关闭数据库时hang住,查看alert 日志,遭遇了SHUTDOWN: Active processes prevent shutdown operation...
  • vindak
  • vindak
  • 2014年01月09日 10:25
  • 1371

Linux Bootup Time

Linux Bootup Time 英文原文地址:http://elinux.org/Boot_Time 1.   简介 启动时间这一话题包括很多子话题,比如启动时间的衡量、启动时间的分析、人为因素分...
  • iamonlyme
  • iamonlyme
  • 2016年06月09日 00:28
  • 699

[sap abap]Workbench Request & Customizing Request的区别

Related T-CODE:            SE10 (Transport Organizer)   Workbence Request:    是针对  SAP Repository Ob...
  • sutton_sap
  • sutton_sap
  • 2015年11月09日 09:24
  • 688

bootup logo的选择,白屏,无图像,小企鹅

linux启动时的图片一般为可爱的小企鹅,不过配置不当就看不到了。想看到的话,我经过实验,下面步骤不可少: 1、配置FB,即是Support for frame buffer devicesdevic...
  • lanmanck
  • lanmanck
  • 2010年01月15日 10:00
  • 2831

linux多线程环境下的抢尸行为(system返回-1:No child processes)

故事背景:    我们这边开发了一个动态库给客户用,动态库里面会调用system来做insmod/rmmod模块的事情。这些模块都是我们这边提供给客户的。拿到客户那边去测试,会随机性的出现system...
  • Joseph_1118
  • Joseph_1118
  • 2014年01月01日 21:27
  • 2948

【Linux】Linux Kernel-Processes(一)

原文:file:///D:/DevDocument/%E5%BC%80%E5%8F%91ebook/linux/linux%E5%86%85%E6%A0%B8%E5%9B%BE%E8%A7%A3/li...
  • moxiaomomo
  • moxiaomomo
  • 2013年12月21日 16:14
  • 1532

linux修改max user processes limits

具体: 最近新上了一批服务器,内核升级到了2.6.32版本,部署完MySQL实例后上到线上,直接负载冲到15,cpu使用达到700%。 01:20:01 PM   runq-sz  plist-s...
  • bbaiggey
  • bbaiggey
  • 2016年03月29日 12:24
  • 4227

Linux系统Shutdown命令定时关机详解

Linux系统下的shutdown命令用于安全的关闭/重启计算机,它不仅可以方便的实现定时关机,还可以由用户决定关机时的相关参数。在执行shutdown命令时,系统会给每个终端(用户)发送一条屏显,提...
  • u010229420
  • u010229420
  • 2015年04月03日 15:23
  • 9873

linux 6.4下max_user_processes和open_file修改

这里只介绍一种永久性的修改方式 使用修改配置文件:
  • mensuo1111
  • mensuo1111
  • 2014年10月17日 16:13
  • 6524
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Customizing the Linux bootup and shutdown processes
举报原因:
原因补充:

(最多只允许输入30个字)