From owner-freebsd-questions Wed Aug 18 23:55: 1 1999 Delivered-To: freebsd-questions@freebsd.org Received: from relay.ucb.crimea.ua (relay.ucb.crimea.ua [212.110.138.1]) by hub.freebsd.org (Postfix) with ESMTP id 77D3D14F06 for ; Wed, 18 Aug 1999 23:53:28 -0700 (PDT) (envelope-from ru@ucb.crimea.ua) Received: (from ru@localhost) by relay.ucb.crimea.ua (8.9.3/8.9.3/UCB) id JAA25303; Thu, 19 Aug 1999 09:50:03 +0300 (EEST) (envelope-from ru) Date: Thu, 19 Aug 1999 09:50:03 +0300 From: Ruslan Ermilov To: "Dan O'Connor" Cc: questions@FreeBSD.ORG Subject: Re: "shutdown -h now" risk? Message-ID: <19990819095003.A27684@relay.ucb.crimea.ua> Mail-Followup-To: Dan O'Connor , questions@FreeBSD.ORG References: <6C37EE640B78D2118D2F00A0C90FCB4401105BA8@site2s1> <4.2.0.58.19990818161828.00bdc8e0@toy> <19990818181702.A3248@athena.tera.com> <005101bee9f3$de5cc8e0$0200000a@home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.3i In-Reply-To: <005101bee9f3$de5cc8e0$0200000a@home>; from Dan O'Connor on Wed, Aug 18, 1999 at 08:34:43PM -0700 X-Operating-System: FreeBSD 3.2-STABLE i386 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 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