System Shutdown

What does it mean to shut down the system? Well, in its simplest form, a shutdown of the system simply means issuing the /sbin/shutdown command. The shutdown command is used to terminate all processing. It has many options, including the following:


-rAutomatically reboots the system; that is, brings it down and brings it up.
-hHalts the system completely.
-yCompletes the shutdown without asking you any questions it would normally ask.
graceSpecifies the number of seconds you wish to wait before the system is shut down, in order to give your users time to save files, quit applications, and log out.

Here are some of the things your system does when you issue the shutdown command:

  • Checks to see whether the user who executed shutdown does indeed have permission to execute the command.

  • Changes the working directory to root (/).

  • Sets PATH to /usr/bin/:/usr/sbin:/sbin.

  • Updates all superblocks.

  • Informs users that a shutdown has been issued and asks them to log out.

  • Executes /sbin/rc, which does such things as shut down subsystems via shutdown scripts such as the spooler and CDE, unmount file systems and other such tasks.

  • Runs /sbin/reboot if the -r option is used.

To shut down and automatically reboot the system, you would type:

$ shutdown -r
					

To halt the system, you would type:

$ shutdown -h
					

You will be asked whether you want to type a message to users informing them of the impending system shutdown. After you type the message, it is immediately sent to all users. After the specified time elapses (60 seconds is the default), the system begins the shutdown process. Once you receive a message that the system is halted, you can power off all your system components.

To shut down the system in two minutes without being asked any questions or sending any message, type:

$ shutdown -h -y 120
					

At times, you will need to go into single-user mode with shutdown to perform some task such as a backup or to expand a logical volume, and then reboot the system to return it to its original state.


To shut down the system into single-user mode, you would type:

$ shutdown
					

The shutdown command with no options puts you into single-user mode. On older versions of the operating system, you could go to single-user mode by using the init command with the s option (init s). However, this is highly discouraged because this command does not terminate other system activity nor does it log users off; therefore, it does not result in a true single-user state.

If the system is already in single-user mode or you like to live dangerously, you can execute /usr/sbin/reboot. I strongly suggest that you issue shutdown, which will call reboot. The reboot command abruptly terminates all processes and then halts or reboots the system. Also, with dynamically loadable kernel modules, reboot will not load these modules; only shutdown will.


Again, I recommend using the shutdown command, not reboot.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.74.44