summaryrefslogtreecommitdiff
path: root/slackbook/html/essential-sysadmin-shutdown.html
diff options
context:
space:
mode:
Diffstat (limited to 'slackbook/html/essential-sysadmin-shutdown.html')
-rw-r--r--slackbook/html/essential-sysadmin-shutdown.html236
1 files changed, 236 insertions, 0 deletions
diff --git a/slackbook/html/essential-sysadmin-shutdown.html b/slackbook/html/essential-sysadmin-shutdown.html
new file mode 100644
index 00000000..a97c78f6
--- /dev/null
+++ b/slackbook/html/essential-sysadmin-shutdown.html
@@ -0,0 +1,236 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta name="generator" content="HTML Tidy, see www.w3.org" />
+<title>Shutting Down Properly</title>
+<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
+<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
+<link rel="UP" title="Essential System Administration" href="essential-sysadmin.html" />
+<link rel="PREVIOUS" title="Users and Groups, the Hard Way"
+href="essential-sysadmin-hardusers.html" />
+<link rel="NEXT" title="Basic Network Commands" href="basic-network-commands.html" />
+<link rel="STYLESHEET" type="text/css" href="docbook.css" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+</head>
+<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
+alink="#0000FF">
+<div class="NAVHEADER">
+<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
+cellspacing="0">
+<tr>
+<th colspan="3" align="center">Slackware Linux Essentials</th>
+</tr>
+
+<tr>
+<td width="10%" align="left" valign="bottom"><a href="essential-sysadmin-hardusers.html"
+accesskey="P">Prev</a></td>
+<td width="80%" align="center" valign="bottom">Chapter 12 Essential System
+Administration</td>
+<td width="10%" align="right" valign="bottom"><a href="basic-network-commands.html"
+accesskey="N">Next</a></td>
+</tr>
+</table>
+
+<hr align="LEFT" width="100%" />
+</div>
+
+<div class="SECT1">
+<h1 class="SECT1"><a id="ESSENTIAL-SYSADMIN-SHUTDOWN"
+name="ESSENTIAL-SYSADMIN-SHUTDOWN">12.3 Shutting Down Properly</a></h1>
+
+<p>It is very important that you shut down your system properly. Simply turning the power
+off with the power switch can cause serious filesystem damage. While the system is on,
+files are in use even if you aren't doing anything. Remember that there are many
+processes running in the background all the time. These processes are managing the system
+and keep a lot of files open. When the system's power is switched off, these files are
+not closed properly and may become corrupted. Depending on what files become damaged, the
+system might be rendered completely unusable! In any case, you'll have to go through a
+long filesystem check procedure on the next reboot.</p>
+
+<div class="NOTE">
+<table class="NOTE" width="100%" border="0">
+<tr>
+<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/note.png"
+hspace="5" alt="Note" /></td>
+<td align="LEFT" valign="TOP">
+<p>If you configured your system with a journalling filesystem, like ext3 or reiserfs,
+you'll be partially protected from filesystem damage, and your filesystem check on reboot
+will be shorter than if you had used a filesystem without journalling, like ext2.
+However, this safety net is no excuse for improperly shutting down your system! A
+journalling FS is meant to protect your files from events beyond your control, not from
+your own laziness.</p>
+</td>
+</tr>
+</table>
+</div>
+
+<p>In any case, when you want to reboot or power down your computer, it is important to
+do so properly. There are several ways of doing so; you can pick whichever one you think
+is the most fun (or least amount of work). Since a shutdown and a reboot are similar
+procedures, most of the ways for powering off the system can also be applied to
+rebooting.</p>
+
+<p>The first method is through the <tt class="COMMAND">shutdown</tt>(8) program, and it
+is probably the most popular. <tt class="COMMAND">shutdown</tt> can be used to reboot or
+turn off the system at a given time, and can display a message to all the logged-in users
+of the system telling them that the system is going down.</p>
+
+<p>The most basic use of shutdown to power down the computer is:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">#</samp> <kbd class="USERINPUT">shutdown -h now</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>In this case, we are not going to send a custom message to the users; they will see
+<tt class="COMMAND">shutdown</tt>'s default message. &#8220;<var
+class="OPTION">now</var>&#8221; is the time that we want to shutdown, and the &#8220;<var
+class="OPTION">-h</var>&#8221; means to halt the system. This is not a very friendly way
+to run a multi-user system, but it works just fine on your home computer. A better method
+on a multiuser system would be to give everyone a little advance warning:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">#</samp> <kbd class="USERINPUT">shutdown -h +60</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>This would shutdown the system in one hour (60 minutes), which would be just fine on a
+normal multiuser system. Vital systems should have their downtime scheduled far in
+advance, and you should post warnings about the downtime in any appropriate locations
+used for system notifications (email, bulletin board, <tt
+class="FILENAME">/etc/motd</tt>, whatever).</p>
+
+<p>Rebooting the system uses the same command, but substitutes &#8220;<var
+class="OPTION">-r</var>&#8221; for &#8220;<var class="OPTION">-h</var>&#8221;:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">#</samp> <kbd class="USERINPUT">shutdown -r now</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>You can use same time notation with <tt class="COMMAND">shutdown -r</tt> that you
+could with <tt class="COMMAND">shutdown -h</tt>. There are a lot of other things that you
+can do with <tt class="COMMAND">shutdown</tt> to control when to halt or reboot the
+machine; see the man page for more details.</p>
+
+<p>The second way of shutting down or powering off the computer is to use the <tt
+class="COMMAND">halt</tt>(8) and <tt class="COMMAND">reboot</tt>(8) commands. As the
+names indicate, <tt class="COMMAND">halt</tt> will immediately halt the operating system,
+and <tt class="COMMAND">reboot</tt> will reboot the system. (<tt
+class="COMMAND">reboot</tt> is actually just a symbolic link to <tt
+class="COMMAND">halt</tt>.) They are invoked like so:</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">#</samp> <kbd class="USERINPUT">halt</kbd>
+<samp class="PROMPT">#</samp> <kbd class="USERINPUT">reboot</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>A lower-level way to reboot or shutdown the system is to talk directly to <tt
+class="COMMAND">init</tt>. All the other methods are simply convenient ways to talk to
+<tt class="COMMAND">init</tt>, but you can directly tell it what to do using <tt
+class="COMMAND">telinit</tt>(8) (note that it only has one &#8220;l&#8221;). Using <tt
+class="COMMAND">telinit</tt> will tell <tt class="COMMAND">init</tt> what runlevel to
+drop into, which will cause a special script to be run. This script will kill or spawn
+processes as needed for that runlevel. This works for rebooting and shutting down because
+both of those are special runlevels.</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">#</samp> <kbd class="USERINPUT">telinit 0</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>Runlevel 0 is halt mode. Telling <tt class="COMMAND">init</tt> to enter runlevel 0
+will cause all processes to be killed off, the filesystems unmounted, and the machine to
+be halted. This is a perfectly acceptable way to bring down the system. On many laptops
+and modern desktop computers, this will also cause the machine to be turned off.</p>
+
+<table border="0" bgcolor="#E0E0E0" width="100%">
+<tr>
+<td>
+<pre class="SCREEN">
+<samp class="PROMPT">#</samp> <kbd class="USERINPUT">telinit 6</kbd>
+</pre>
+</td>
+</tr>
+</table>
+
+<p>Runlevel 6 is reboot mode. All processes will be killed off, the filesystems will be
+unmounted, and the machine will be rebooted. This is a perfectly acceptable method of
+rebooting the system.</p>
+
+<p>For the curious, when switching to runlevel 0 or 6, whether by using <tt
+class="COMMAND">shutdown</tt>, <tt class="COMMAND">halt</tt>, or <tt
+class="COMMAND">reboot</tt>, the script <tt class="FILENAME">/etc/rc.d/rc.6</tt> is run.
+(The script <tt class="FILENAME">/etc/rc.d/rc.0</tt> is another symbolic link, to <tt
+class="FILENAME">/etc/rc.d/rc.6</tt>.) You can customize this file to your tastes--but be
+sure to test your changes carefully!</p>
+
+<p>There is one last method of rebooting the system. All the other methods require you to
+be logged in as <tt class="USERNAME">root</tt>. However, it is possible to reboot the
+machine even if you aren't root, provided that you have physical access to the keyboard.
+Using <b class="KEYCAP">Control</b>+<b class="KEYCAP">Alt</b>+<b
+class="KEYCAP">Delete</b> (the "three-fingered salute") will cause the machine to
+immediately reboot. (Behind the scenes, the <tt class="COMMAND">shutdown</tt> command is
+called for you when you use <b class="KEYCAP">Control</b>+<b class="KEYCAP">Alt</b>+<b
+class="KEYCAP">Delete</b>.) The salute doesn't always work when using X Windows--you may
+need to use <b class="KEYCAP">Control</b>+<b class="KEYCAP">Alt</b>+<b
+class="KEYCAP">F1</b> (or another Function key) to switch to a non-X Windows terminal
+before using it.</p>
+
+<p>Finally, the file that ultimately controls every aspect of startup and shutdown is the
+<tt class="FILENAME">/etc/inittab</tt>(5) file. In general, you should not need to modify
+this file, but it may give you insight into why some things work the way they do. As
+always, see the man pages for further details.</p>
+</div>
+
+<div class="NAVFOOTER">
+<hr align="LEFT" width="100%" />
+<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
+cellspacing="0">
+<tr>
+<td width="33%" align="left" valign="top"><a href="essential-sysadmin-hardusers.html"
+accesskey="P">Prev</a></td>
+<td width="34%" align="center" valign="top"><a href="index.html"
+accesskey="H">Home</a></td>
+<td width="33%" align="right" valign="top"><a href="basic-network-commands.html"
+accesskey="N">Next</a></td>
+</tr>
+
+<tr>
+<td width="33%" align="left" valign="top">Users and Groups, the Hard Way</td>
+<td width="34%" align="center" valign="top"><a href="essential-sysadmin.html"
+accesskey="U">Up</a></td>
+<td width="33%" align="right" valign="top">Basic Network Commands</td>
+</tr>
+</table>
+</div>
+</body>
+</html>
+