Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Jan 98 14:22:23 -0400
From:      "A. Ling" <aling@alum.mit.edu>
To:        "FreeBSD-questions" <freebsd-questions@FreeBSD.ORG>
Subject:   Proper shutdown method? (was: /etc/shutdown.d not in bsd)
Message-ID:  <199801071922.OAA17067@havea.min.net>

next in thread | raw e-mail | index | archive | help
   As a newbie, I'd just like to clarify.  I've been doing what the
tutorial (http://www.freebsd.org/tutorials/newuser/newuser.html) talks
about:

To shut down the machine type: 
     # /sbin/shutdown -h now
Or to reboot type 
     # /sbin/shutdown -r now

Now man shutdown(8) says in part:
     Available friendlinesses:
     -h    The system is halted at the specified time
           when shutdown execs halt(8).

So if shutdown -r just warns other users before eventually exec'ing halt,
and if as Leif says halt doesn't signal init, it would seem that
/etc/rc.shutdown is at least not guaranteed to run, or maybe never is run,
and the proper way to to an orderly shutdown is to send some signal to
init.  Is this what he's saying he's modified his system to do?  And if
so, what command to 2.2.5R (I'm going to upgrade) sends the proper signal?
 Does it explain a symptom I've been noticing under 2.2.2R where I
sometimes, but not always see a message in bright text something like
"Syncing disks 3 2 Done \n Press any key to reboot"? -- when it doesnt
type this, I've waited up to 30 minutes more without any further text
printing, or hearing disk activity.  The next boot almost never gives fsck
error messages.
   Thanks for any enlightenment.
------------- Earlier message fragment: --------------
From: leifn@image.dk (Leif Neland)
Date: 07 Jan 98 13:01:48 +0100
Subject: Re: /etc/shutdown.d not in bsd

At 05 Jan 98 08:13:58 Joel Ray Holveck wrote regarding Re: /etc/shutdown.d
not in bsd

 >>> Being used to /etc/shutdown.d in SysV, I can't understand BSD can
 >>> do without it.

 >> Because the system will shut them down for you.  When the system is
 >> halted, every process is sent a SIGTERM (signal 15).  most
 >> processes will then exit gracefully.  (Some evil ones that mask
 >> SIGTERM then get a SIGKILL to finish them off).

 JR> He means to ensure that, for instance, a process which dies with
 JR> runtime summaries is killed before syslogd; a client which send a
 JR> shutdown message to its server is killed before PPP, etc.
 JR>
 JR> This is done by /etc/rc.shutdown, as mentioned in init(8).

But here comes the nasty thing: halt/reboot does NOT signal init, so init
doesn't get a chance to execute /etc/rc.shutdown.

halt/reboot just kills everything in sight itself.

When doint kill -INT 1 or kill -TERM 1, init runs /etc/rc.shutdown, and
reboots
or goes into singleuser mode.
------------ end of fragment ------------




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