Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Aug 1999 09:50:03 +0300
From:      Ruslan Ermilov <ru@ucb.crimea.ua>
To:        "Dan O'Connor" <dan@jgl.reno.nv.us>
Cc:        questions@FreeBSD.ORG
Subject:   Re: "shutdown -h now" risk?
Message-ID:  <19990819095003.A27684@relay.ucb.crimea.ua>
In-Reply-To: <005101bee9f3$de5cc8e0$0200000a@home>; from Dan O'Connor on Wed, Aug 18, 1999 at 08:34:43PM -0700
References:  <6C37EE640B78D2118D2F00A0C90FCB4401105BA8@site2s1> <4.2.0.58.19990818161828.00bdc8e0@toy> <19990818181702.A3248@athena.tera.com> <005101bee9f3$de5cc8e0$0200000a@home>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 18, 1999 at 08:34:43PM -0700, Dan O'Connor wrote:
> The 'reboot' man page says this:
> 
>     "The halt and reboot utilities flush the file system cache
>     to disk, send all running processes a SIGTERM (and
>     subsequently a SIGKILL) and, respectively, halt or restart
>     the system...."
> 
Yup.

> Then the 'shutdown' man page says this:
> 
>     "The following options are available:
>     ...
>     -o    If one of the -h, -p or -r is specified, shutdown will execute
> halt(8) or reboot(8) instead of sending signal to init(8)."
> 
And also it says:

} At shutdown time a message is written to the system log, containing the
} time of shutdown, the person who initiated the shutdown and the reason.
} Corresponding signal is then sent to init(8) to respectively halt, reboot
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
} or bring the system down to single-user state (depending on the above op-
} tions).  The time of the shutdown and the warning message are placed in
} /var/run/nologin and should be used to inform the users about when the
} system will be back up and why it is going down (or anything else).


> So, I guess the new question is: What's the difference between the way
> "halt" and "reboot" handle shutdowns versus the way "init" does it? And is
> one method preferable over the other?
> 
> Enquiring minds want to know...
> 
init(8) manpage says:
} When shutting down the machine, init will try to run the /etc/rc.shutdown
} script. This script can be used to cleanly terminate specific programs
} such as innd (the InterNetNews server).

This is the only significant difference in how init(8) and reboot/halt(8)
handle the shutdown.  Halt(8) won't execute rc.shutdown script.

Also, the following functionality was recently added (both CURRENT and STABLE):

init.c,v 1.32:
date: 1999/06/16 20:01:19;  author: ru;  state: Exp;  lines: +12 -5
Init(8) will halt the system if sent USR1 signal,
or halt and turn the power off if sent SIGUSR2.

PR:             5451
Submitted by:   Leif Neland <leifn@image.dk>
Reworked by:    ru
Reviewed by:    -hackers


shutdown.c,v 1.19:
date: 1999/06/21 16:06:21;  author: ru;  state: Exp;  lines: +52 -34
Signal init(8) instead of executing halt(8) or reboot(8)
when halting or rebooting the system.  It benefits from
running /etc/rc.shutdown by init(8).

``-o'' flag is provided for backward compatibility.

PR:             5451
Discussed with: des

-- 
Ruslan Ermilov		Sysadmin and DBA of the
ru@ucb.crimea.ua	United Commercial Bank,
ru@FreeBSD.org		FreeBSD committer,
+380.652.247.647	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990819095003.A27684>