535 lines
8.2 KiB
HTML
535 lines
8.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
<HTML
|
||
><HEAD
|
||
><TITLE
|
||
>Shutting Down/Rebooting the System</TITLE
|
||
><META
|
||
NAME="GENERATOR"
|
||
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
|
||
REL="HOME"
|
||
TITLE="GNU/Linux Command-Line Tools Summary"
|
||
HREF="index.html"><LINK
|
||
REL="UP"
|
||
TITLE="Controlling the system"
|
||
HREF="controlling-the-system.html"><LINK
|
||
REL="PREVIOUS"
|
||
TITLE="Mounting and Unmounting (Floppy/CDROM/Hard-drive Partitions)"
|
||
HREF="mounting-and-unmounting.html"><LINK
|
||
REL="NEXT"
|
||
TITLE="Controlling Processes"
|
||
HREF="controlling-processes.html"></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"
|
||
>GNU/Linux Command-Line Tools Summary</TH
|
||
></TR
|
||
><TR
|
||
><TD
|
||
WIDTH="10%"
|
||
ALIGN="left"
|
||
VALIGN="bottom"
|
||
><A
|
||
HREF="mounting-and-unmounting.html"
|
||
ACCESSKEY="P"
|
||
>Prev</A
|
||
></TD
|
||
><TD
|
||
WIDTH="80%"
|
||
ALIGN="center"
|
||
VALIGN="bottom"
|
||
>Chapter 9. Controlling the system</TD
|
||
><TD
|
||
WIDTH="10%"
|
||
ALIGN="right"
|
||
VALIGN="bottom"
|
||
><A
|
||
HREF="controlling-processes.html"
|
||
ACCESSKEY="N"
|
||
>Next</A
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
><HR
|
||
ALIGN="LEFT"
|
||
WIDTH="100%"></DIV
|
||
><DIV
|
||
CLASS="SECT1"
|
||
><H1
|
||
CLASS="SECT1"
|
||
><A
|
||
NAME="SHUTTING-DOWN"
|
||
></A
|
||
>9.2. Shutting Down/Rebooting the System</H1
|
||
><P
|
||
></P
|
||
><DIV
|
||
CLASS="VARIABLELIST"
|
||
><DL
|
||
><DT
|
||
>shutdown now</DT
|
||
><DD
|
||
><P
|
||
>Shutdown the computer immediately (don't power down). Note that in <SPAN
|
||
CLASS="PRODUCTNAME"
|
||
>UNIX</SPAN
|
||
> systems this kind of shutdown means to go to “ single-user mode”. Single-user mode is a mode where only the administrator (root) has access to the computer, this mode is designed for maintenance and is often used for repairs.</P
|
||
><P
|
||
>For example this would take you to single user mode </P
|
||
><TABLE
|
||
BORDER="1"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="90%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="SCREEN"
|
||
>shutdown now</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
></DD
|
||
><DT
|
||
>shutdown -h now</DT
|
||
><DD
|
||
><P
|
||
>Shutdown <EM
|
||
>(-h = halt) </EM
|
||
>the computer immediately. It begins the shutdown procedure, press
|
||
<B
|
||
CLASS="KEYCAP"
|
||
>CTRL</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>C</B
|
||
>
|
||
|
||
(break-key) to stop it. After the end of the command you can also leave a message in quotation marks which will be broad-casted to all users, for example:</P
|
||
><TABLE
|
||
BORDER="1"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="90%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="SCREEN"
|
||
>shutdown -h now "Warning system malfunction, self-destruct imminent"</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
><P
|
||
>This would halt the system and send the message to anyone who is currently logged in.</P
|
||
><DIV
|
||
CLASS="TIP"
|
||
><P
|
||
></P
|
||
><TABLE
|
||
CLASS="TIP"
|
||
WIDTH="90%"
|
||
BORDER="0"
|
||
><TR
|
||
><TD
|
||
WIDTH="25"
|
||
ALIGN="CENTER"
|
||
VALIGN="TOP"
|
||
><IMG
|
||
SRC="../images/tip.gif"
|
||
HSPACE="5"
|
||
ALT="Tip"></TD
|
||
><TH
|
||
ALIGN="LEFT"
|
||
VALIGN="CENTER"
|
||
><B
|
||
>Shutting down at a particular time</B
|
||
></TH
|
||
></TR
|
||
><TR
|
||
><TD
|
||
> </TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
VALIGN="TOP"
|
||
><P
|
||
>You can also put a time that the system should shutdown instead of “now”. Typing “+x minutes” (any number of minutes is appropriate) or you can even set an exact time. For example to shutdown at 11:50 type:
|
||
<TABLE
|
||
BORDER="1"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="90%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="SCREEN"
|
||
>shutdown -h 11:50</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
></P
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
></DIV
|
||
><DIV
|
||
CLASS="NOTE"
|
||
><P
|
||
></P
|
||
><TABLE
|
||
CLASS="NOTE"
|
||
WIDTH="90%"
|
||
BORDER="0"
|
||
><TR
|
||
><TD
|
||
WIDTH="25"
|
||
ALIGN="CENTER"
|
||
VALIGN="TOP"
|
||
><IMG
|
||
SRC="../images/note.gif"
|
||
HSPACE="5"
|
||
ALT="Note"></TD
|
||
><TH
|
||
ALIGN="LEFT"
|
||
VALIGN="CENTER"
|
||
><B
|
||
>Shutdown -h vs poweroff</B
|
||
></TH
|
||
></TR
|
||
><TR
|
||
><TD
|
||
> </TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
VALIGN="TOP"
|
||
><P
|
||
>On some systems, <EM
|
||
>shutdown -h </EM
|
||
>and <EM
|
||
>halt </EM
|
||
>do not actually turn the system's power off. On systems that do not power off with these commands use the <EM
|
||
>poweroff</EM
|
||
> command</P
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
></DIV
|
||
></DD
|
||
><DT
|
||
>halt</DT
|
||
><DD
|
||
><P
|
||
>The same as <EM
|
||
>shutdown -h now</EM
|
||
> doesn't take any options, this command simply shuts down immediately.</P
|
||
></DD
|
||
><DT
|
||
>shutdown -r now</DT
|
||
><DD
|
||
><P
|
||
>Shutdown (<EM
|
||
> -r = reboot</EM
|
||
>) the computer immediately. It begins the reboot procedure, press
|
||
<B
|
||
CLASS="KEYCAP"
|
||
>CTRL</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>C</B
|
||
>
|
||
|
||
(break-key) to stop it. After the end of the command you can also leave a message in quotation marks which will be broad-casted to all users, for example: </P
|
||
><TABLE
|
||
BORDER="1"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="90%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="SCREEN"
|
||
>shutdown -r now "Warning system rebooting, all files will be destroyed"</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
><P
|
||
>This would reboot the system and send the message to anyone who was logged in.</P
|
||
><DIV
|
||
CLASS="TIP"
|
||
><P
|
||
></P
|
||
><TABLE
|
||
CLASS="TIP"
|
||
WIDTH="90%"
|
||
BORDER="0"
|
||
><TR
|
||
><TD
|
||
WIDTH="25"
|
||
ALIGN="CENTER"
|
||
VALIGN="TOP"
|
||
><IMG
|
||
SRC="../images/tip.gif"
|
||
HSPACE="5"
|
||
ALT="Tip"></TD
|
||
><TH
|
||
ALIGN="LEFT"
|
||
VALIGN="CENTER"
|
||
><B
|
||
>Rebooting at a particular time</B
|
||
></TH
|
||
></TR
|
||
><TR
|
||
><TD
|
||
> </TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
VALIGN="TOP"
|
||
><P
|
||
>You can also put a time that the system should reboot instead of “now”. Typing “+x minutes” (any number of minutes is appropriate) or you can even set an exact time. For example to reboot at 11:50 type:
|
||
<TABLE
|
||
BORDER="1"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="90%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="SCREEN"
|
||
>shutdown -r 11:50</PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
></P
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
></DIV
|
||
></DD
|
||
><DT
|
||
>reboot</DT
|
||
><DD
|
||
><P
|
||
>The same as <EM
|
||
>shutdown -r now</EM
|
||
>, doesn't take any options, simply reboots the computer immediately. </P
|
||
></DD
|
||
><DT
|
||
><B
|
||
CLASS="KEYCAP"
|
||
>CTRL</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>ALT</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>DEL</B
|
||
> </DT
|
||
><DD
|
||
><P
|
||
> (key-combination) May be used from a terminal to reboot or shutdown, it depends on your system configuration. Note that this doesn't work from an xterminal.
|
||
<B
|
||
CLASS="KEYCAP"
|
||
>CTRL</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>ALT</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>DEL</B
|
||
>
|
||
|
||
begins the reboot/shutdown immediately, the user does not have to be logged in.</P
|
||
><DIV
|
||
CLASS="TIP"
|
||
><P
|
||
></P
|
||
><TABLE
|
||
CLASS="TIP"
|
||
WIDTH="90%"
|
||
BORDER="0"
|
||
><TR
|
||
><TD
|
||
WIDTH="25"
|
||
ALIGN="CENTER"
|
||
VALIGN="TOP"
|
||
><IMG
|
||
SRC="../images/tip.gif"
|
||
HSPACE="5"
|
||
ALT="Tip"></TD
|
||
><TH
|
||
ALIGN="LEFT"
|
||
VALIGN="CENTER"
|
||
><B
|
||
>You can change the behaviour of
|
||
<B
|
||
CLASS="KEYCAP"
|
||
>CTRL</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>ALT</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>DEL</B
|
||
>
|
||
|
||
from rebooting</B
|
||
></TH
|
||
></TR
|
||
><TR
|
||
><TD
|
||
> </TD
|
||
><TD
|
||
ALIGN="LEFT"
|
||
VALIGN="TOP"
|
||
><P
|
||
>To disable
|
||
<B
|
||
CLASS="KEYCAP"
|
||
>CTRL</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>ALT</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>DEL</B
|
||
>
|
||
|
||
from rebooting your computer (or to have it do something different), you can edit the /etc/inittab file (as root). </P
|
||
><P
|
||
>Here is how it looks on a Mandrake/Mandriva <SPAN
|
||
CLASS="PRODUCTNAME"
|
||
>Linux</SPAN
|
||
> system:
|
||
<TABLE
|
||
BORDER="1"
|
||
BGCOLOR="#E0E0E0"
|
||
WIDTH="90%"
|
||
><TR
|
||
><TD
|
||
><FONT
|
||
COLOR="#000000"
|
||
><PRE
|
||
CLASS="SCREEN"
|
||
># Trap
|
||
<B
|
||
CLASS="KEYCAP"
|
||
>CTRL</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>ALT</B
|
||
>-<B
|
||
CLASS="KEYCAP"
|
||
>DEL</B
|
||
>
|
||
|
||
ca::ctrlaltdel:/sbin/shutdown -t3 -r now </PRE
|
||
></FONT
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
></P
|
||
><P
|
||
>Note that the # means a comment (and is not used). If you simply put a # (hash) before the command it would disable it (it would become a comment). </P
|
||
><P
|
||
>You could also change the command it runs for example if you changed the <EM
|
||
>-r</EM
|
||
> to a <EM
|
||
>-h </EM
|
||
>the computer would turn off instead of rebooting, or you could have it do anything you want. It's up to your creativity to make it do something interesting.</P
|
||
></TD
|
||
></TR
|
||
></TABLE
|
||
></DIV
|
||
></DD
|
||
></DL
|
||
></DIV
|
||
></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="mounting-and-unmounting.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="controlling-processes.html"
|
||
ACCESSKEY="N"
|
||
>Next</A
|
||
></TD
|
||
></TR
|
||
><TR
|
||
><TD
|
||
WIDTH="33%"
|
||
ALIGN="left"
|
||
VALIGN="top"
|
||
>Mounting and Unmounting (Floppy/CDROM/Hard-drive Partitions)</TD
|
||
><TD
|
||
WIDTH="34%"
|
||
ALIGN="center"
|
||
VALIGN="top"
|
||
><A
|
||
HREF="controlling-the-system.html"
|
||
ACCESSKEY="U"
|
||
>Up</A
|
||
></TD
|
||
><TD
|
||
WIDTH="33%"
|
||
ALIGN="right"
|
||
VALIGN="top"
|
||
>Controlling Processes</TD
|
||
></TR
|
||
></TABLE
|
||
></DIV
|
||
></BODY
|
||
></HTML
|
||
> |