[3821] in RedHat Linux List
Re: UPS reccomendations
daemon@ATHENA.MIT.EDU (Richard Bullington)
Mon Nov 11 02:12:30 1996
Date: Mon, 11 Nov 1996 02:09:27 -0500 (EST)
From: Richard Bullington <rbulling@obscure.org>
To: m-schout@tamu.edu
cc: redhat-list@redhat.com
In-Reply-To: <199611110653.AAA19984@Joker.tamu.edu>
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
On Mon, 11 Nov 1996, Mike Schout wrote:
> > Someone made an RPM, but I caution those who install it that it
> > doesn't shut down your system properly. It contains a hard-coded
> > sequence of commands to halt the OS, rather than signalling the init
> > process to carry out an orderly shutdown. Not a good idea.
>
> If your referring to apcd, which is what we are using with our APC smart
> UPS's, I dont see a problem with it. It does not completely HALT the os,
> but it comes about as close to it as possible. It turns off networking,
> unmounts file systems (this is the important one), and then will turn the
> UPS off. I think that the reason it doesnt completely halt the OS is
> because it needs to still send the signal to turn off the UPS.
I think he is referring to either powerd or backupsd. I looked at
backupsd, and it does have a hard-coded sequence in there that is taken
from shutdown.c. Not recommended. Yuck.
The Smart UPSes are smart because they have an onboard microcontroller
that can do things like 'when I get the right command over the serial
line, wait 60 seconds and turn the power off'. (by the way, the
BackUPS-Pro appears to be a cut-down Smart UPS, that supports smart
signaling. I have patched apcd to handle the BackUPS Pro. If there is
interest, I could make these patches available.)
In apcd-0.5, the source code for do_shutdown is crystal clear. It signals
the UPS to shut down, then initiates a regular shutdown via calling
"/sbin/shutdown now -hft 2" , which will halt the system after only a few
seconds in most cases.
(from apcd.h:)
#define _PATH_SHUTDOWN "/sbin/shutdown"
#define SHUTDOWN_ARGS "shutdown","now","-hft","2"
(from apcd.c:)
do_shutdown()
{
char answer[MAXLINE];
char a;
syslog(LOG_INFO, "System cleanup");
if (slave == 2) fclose(UPSlogfile);
/* Prime the system for a shutdown */
sync();
sleep(2);
if(slave==2) {
/* Tell the UPS to shut itself off in about a minute */
/* Get the attention of the UPS */
a='Y';
write(port,&a,1);
getline(port,answer);
/* Tell it to do a power off*/
a = 'S';
write(port,&a,1);
/* We really should check the results of this, to see if
the
power is REALLY going off at this point, because the
"shutdown the power and come back when AC is restored"
command can return values other than OK. */
}
/* Execute the real shutdown command */
execl(_PATH_SHUTDOWN, SHUTDOWN_ARGS, NULL);
/* Uh-oh, the exec failed */
syslog(LOG_ERR,"exec of %s failed because: %s! Aborting program!",
_PATH_SHUTDOWN, strerror(errno));
exit(0);
}
-Richard Bullington <rbulling@obscure.org> http://www.obscure.org
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
________________________________________________________________________
http://www.redhat.com/RedHat-FAQ http://www.redhat.com/RedHat-Errata
http://www.redhat.com/RedHat-Tips http://www.redhat.com/mailing-lists
------------------------------------------------------------------------
To unsubscribe: mail -s unsubscribe redhat-list-request@redhat.com < /dev/null