Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Linux+ Certification Bible.pdf
Скачиваний:
46
Добавлен:
15.03.2015
Размер:
3.78 Mб
Скачать

Chapter 11 Linux System Commands 361

Shutting down Linux

As with most operating systems, you need to properly shut down your Linux system to avoid damaging the system and the user data on the file systems. If your file systems are not properly unmounted, the system runs a file system check the next time the system is booted.

Know how each of the shutdown commands work, and why to choose a certain command.

You may need to shut down a Linux system for several reasons, including the following:

General maintenance: When you reboot a Linux system, it always performs some general maintenance tasks, such as deleting files from the temporary directories and performing checks on the machine’s file systems. Restarting a system will also reset any dead or zombie processes that may be running.

System failure: Often, your only recourse in the event of a system or process failure is to reboot the system. You may have to reboot for many reasons, including failure of system processes, locked devices, or runaway processes, which use up all the available CPU and RAM.

System upgrades: Some system upgrades, such as a kernel update, only work if the system is rebooted.

The commands that you can use to safely shut down the system are shutdown, halt, and reboot. The shutdown command is the most commonly used command for shutting down a Linux system, and there are several options that can be used for it. For example:

shutdown -r now

The preceding option will shut down the Linux system immediately and initiate a reboot. If you don’t want the system to reboot, and you’d rather have the system come to a halt, you can use the following command:

shutdown -h now

You should give your users warning before any type of scheduled shutdown in order to give them time to close their files and log out of the system. You can give the shutdown command a time parameter (in seconds) before it initiates shutdown:

shutdown -h 300

The halt command performs the same function as a shutdown -h now command, or init 0, and brings the system to a halt without rebooting. The reboot command performs the same function as a shutdown -r now command, or init 6. It brings the system down and reboots it. (Hitting the key combination, Ctrl-Alt-Delete can also start this function process).

Соседние файлы в предмете Операционные системы