Date: Fri, 27 Sep 2002 08:29:51 -0400 From: "Brian T. Schellenberger" <bts@babbleon.org> To: Petri Riihikallio <Petri.Riihikallio@metis.fi>, questions@freebsd.org Subject: Re: How to shut down cleanly by killing power Message-ID: <200209270829.51463.bts@babbleon.org> In-Reply-To: <a05111b04b9b9eae5d18f@[192.168.0.2]> References: <a05111b04b9b9eae5d18f@[192.168.0.2]>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday 27 September 2002 07:01 am, Petri Riihikallio wrote: | >hmmmm.... I use apcupsd from ports which has shown to be very | > reliable and has great docs. It has been months since I looked at | > this stuff, but remember something like this issue you make was | > covered in detail. | | Thanks, good pointer: | http://www.apcupsd.com/users_manual/shutdown.html discusses the | problem. In RedHat the disks are mounted back read-only at shutdown. | I'll have to check how the FreeBSD port implements this. | | >I don't have any BIOS conflict that you mention that | >will fight the daemons. They will shut down even if the power | > returns if the minimum has been reached or exceeded. There are also | > other settings that check things and allow the machines to resume | > proper operation -- however, once the "doomsday" point is reached | > -- the "shutdown -p now" will prevail. It will then require manual | > restarts of those that are shut down. | | I don't want to argue, but.. | | I have no BIOS conflict per se. I have just set up my BIOS to boot | the system when power appears. The problem is: What happens if power | never disappears? The fact of the matter is that if the timing is *just* wrong you probably can't automatically recover. How likely is that to happen? But, if you want to be "super safe," then you should be able to "shutdown" rather than than "shutdown -h" or "shutdown -p." This should do most of the steps of shutdown and get all the users off to make partitions non-busy. It may even umount all the partitions; I can't quite recall. Then it will start up /bin/sh. I can't recall whether /bin/sh will run any of the 'normal' startup scripts under this circumstance, but even if it does not you can replace it with a munged one that does . . . But the idea would be that on power-down you set a special "powering-down" file just before you issue the "shutdown." The /bin/csh startup scripts check and if that is set, they go into "shutdown mode", which umounts all but the root partition, remount the root partition read-only, and then the simply sleep for 120 seconds or so, and then "shutdown -r now." (Of course it should remove that special marker file before it does anything else lest the system go into a loop.) Now, one of two things happens: either you really *did* power off, in which case the "sleep" never wakes up, because without power it can't go on. Then when you get power back, the BIOS does its thing and you reboot. Or the power never went off, in which after two minutes everything reboots. | | "shutdown -p now" kills apcupsd before it turns the power off. There | is a time frame when there is no monitoring software running. If | power returns in that time frame, you have to boot up manually. In | RedHat Linux apcupsd is run once more in single-user mode with | "/etc/apcupsd/apccontrol killpower". | | It appears you could test your setup with "/etc/apcupsd/apccontrol | doshutdown". Do not pull the plug, just let the software shut down | the system. If it reboots after a while - you have no problem. The | "while" depends on shutdown grace delay, which value you can check | with "apcaccess eeprom". I have a dumb BackUPS, so I don't have any | delay. | | Thank you for your time! -- Brian, the man from Babble-On . . . . bts@babbleon.org (personal) 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?200209270829.51463.bts>