Date: Mon, 25 Sep 2000 14:52:23 -0400 (EDT) From: mi@aldan.algebra.com To: Gabriel Ambuehl <gabriel_ambuehl@buz.ch> Cc: stable@FreeBSD.ORG Subject: Re: Freebsd vs. UPS Message-ID: <200009251852.OAA75222@misha.privatelabs.com> In-Reply-To: <44191516796.20000925203657@buz.ch>
next in thread | previous in thread | raw e-mail | index | archive | help
--0-1804289383-969907956=:75219 Content-Type: TEXT/plain; CHARSET=US-ASCII On 25 Sep, Gabriel Ambuehl wrote: = I need to get some protection for our servers and I need to know if = FreeBSD supports the almighty APC UPS (shutting the servers down in = the worst case and rebooting them when power is back, is enough...) = with some port. We here use the upsmon (/usr/ports/sysutils/upsmon). It is not very configurable, but it is open-source, so you can extend it the way you like it. We had to apply the attached-patch to stop it from crashing when UPS is not connected at start up. The patch is suitable for the port's patches subdirectory. Look for other utilities in /usr/ports/sysutils/ too. Some let you execute an arbitrary command on power-related events, which may initiate a shutdown sequence on other servers (over ssh). -mi --0-1804289383-969907956=:75219 Content-Type: TEXT/plain; CHARSET=US-ASCII Content-Description: don't crash when UPS does not respond Content-Disposition: attachment ; filename="patch-ac" This patch prevents the upsmond from crashing when UPS is not connected or when it failed to respond to the UPS_GET_STATUS for some reason. -mi --- upsmonitor.cc Tue Aug 4 17:18:14 1998 +++ upsmonitor.cc Tue Apr 25 18:45:59 2000 @@ -175,2 +175,3 @@ CBuffer *pbufSend; // socket send buffer + const char *model_version; @@ -183,5 +184,9 @@ pResp->iFunctionID = UPS_GET_STATUS; - pResp->iRetCode = RC_SUCCESS; strcpy(pResp->szUpsmondVersion,m_szUpsmondVersion); - strcpy(pResp->szModel,m_pUps->ReadString(UPS_CMD_MODEL)); + if ((model_version = m_pUps->ReadString(UPS_CMD_MODEL)) == NULL) { + pResp->iRetCode = RC_FAILED; + goto Write; + } + pResp->iRetCode = RC_SUCCESS; + strcpy(pResp->szModel,model_version); strcpy(pResp->szCopyRight,m_pUps->ReadString(UPS_CMD_COPYRIGHT)); @@ -203,2 +208,3 @@ pResp->dBatteryLevel = m_pUps->ReadDouble(UPS_CMD_LEVEL); +Write: pbufSend->SetLength(sizeof(UpsInfoResp)); --0-1804289383-969907956=:75219-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009251852.OAA75222>