% Linux Installation and Getting Started    -*- TeX -*-
% shutdown.tex
% Copyright (c) 1993 by Matt Welsh and Lars Wirzenius
%
% This file is freely redistributable, but you must preserve this copyright 
% notice on all copies, and it must be distributed only as part of "Linux 
% Installation and Getting Started". This file's use is covered by
% the copyright for the entire document, in the file "copyright.tex".

\section{Shutting Down}
\label{sec-sysadm-shutdown}

\index{system administration!shutting down|(}
\index{shutting down|(}
Shutting down a Linux system is a bit tricky. Remember that you should
never just turn off the power or hit the reset switch while the system 
is running. The kernel keeps track of disk I/O in memory buffers. If
you reboot the system without giving the kernel the chance to write
its buffers to disk, you can corrupt your filesystems.

Other precautions are taken at shutdown time as well. All processes
are sent a signal, which allows them to die gracefully (writing and
closing all files, and so on). Filesystems are unmounted for safety.
If you wish, the system can also alert users that the system is going
down and give them a change to log off.

\index{shutdown command@{\tt shutdown} command}
The easiest way to shutdown is with the {\tt shutdown} command. The
format of the command is
\begin{tscreen}
shutdown \cparam{time} \cparam{warning-message}
\end{tscreen}
The \cparam{time} argument is the time to shutdown the system (in
the format {\em hh:mm:ss}), and \cparam{warning-message} is a message
displayed on all user's terminals before shutdown. Alternately, you
can specify the \cparam{time} as ``{\tt now}'', to shutdown 
immediately. The {\tt -r} option may be given to {\tt shutdown} to
reboot the system after shutting down.

For example, to shutdown the system at 8:00pm, use the command
\begin{tscreen}
\# {\em shutdown -r 20:00}
\end{tscreen}

\index{halt@{\tt halt}}
The command {\tt halt} may be used to force an immediate shutdown, 
without any warning messages or grace period. {\tt halt} is useful
if you're the only one using the system, and want to shut down the
system and turn it off.

\blackdiamond Don't turn off the power or reboot the system until you
see the message:
\begin{tscreen}
The system is halted
\end{tscreen}
It is very important that you shutdown the system ``cleanly'' using
the {\tt shutdown} or {\tt halt} commands. On some systems, pressing
\key{ctrl-alt-del} will be trapped and cause a {\tt shutdown}; on other
systems, however, using the ``Vulcan nerve pinch'' will reboot the
system immediately and may cause disaster.

\index{system administration!shutting down|)}
\index{shutting down|)}
