Subject: Re: Action of halt/reboot from scripts
To: Lennart Augustsson <augustss@cs.chalmers.se>
From: Chris Jones <cjones@honors.montana.edu>
List: current-users
Date: 02/13/1998 12:13:08
On Fri, 13 Feb 1998, Lennart Augustsson wrote:
> > Yes, that produces the same outcome (using shutdown -fr now). The
> > machine _looks_ as though it is shutting down from the messages on the
> > console, but it doesn't get any further than killing most of the
> > processes (This is from the CGI script, BTW).
>
> I've had the same problem.  I've written a little program
> that calls shutdown, but the machine doesn't shut down.
> Some processes die, but then it hangs.  I've not tracked
> down the problem, but I suspect that shutdown (and reboot)
> manages to kill itself somehow.

My guess is that shutdown (or halt or reboot) sends the proper signal to
the kernel and thereby to init, whereupon processes start getting killed.
Your shutdown/halt/reboot process won't get killed, but its parent will.
Oops.  That sends a SIGHUP to shutdown, because its parent just died.  At
that point, if shutdown isn't written to ignore SIGHUP, it'll die.  What
this does to the shutdown system call, I can only guess.

Assuming all of the above is true, you can do a "nohup shutdown -r now",
and it should work just fine.

Chris

-------------------------------------------------------------------------------
Chris Jones                                      cjones@rupert.oscs.montana.edu
           Mad scientist in training...
"Is this going to be a stand-up programming session, sir, or another bug hunt?"