In the last post I’ve laid out the potential benefit of using an UPS along with a properly configured software. The port to use for connecting an UPS from APC to your FreeBSD box is
sysutils/apcupsd. Altough it comes with a reasonable set of standard config files, I nevertheless give beneath an example of a single box connected to the UPS:
## apcupsd.conf v1.1 ## UPSCABLE usb UPSTYPE usb DEVICE /dev/ugen0 LOCKFILE /var/spool/lock #EVENTSFILE /var/log/apcupsd.events #EVENTSFILEMAX 10 #UPSCLASS standalone #UPSMODE disable #BEEPSTATE 0 TIMEOUT 0 BATTERYLEVEL 5 MINUTES 3 NOLOGON disable #ANNOY 300 #ANNOYDELAY 60 The configuration directives up to
EVENTSFILE are self-explanatory and need no further discussion.
EVENTSFILEMAX gives the maximum in kilobytes the events file can have before overwriting existing entries (starting with the oldest).
UPSCLASS define the role of the machine in respect to the UPS. The default is that it’s the only one connected to the battery. With one can control the audio-alarms. (Beep if the power goes out, beep even more if the batteries are depleated, etc.). The following three variables hold different inidcators when to shut down the box if power fails. Reasonably, shut down is initiated if the first condition is met:
TIMEOUTis the value in seconds after switching to batteries when shut down should be initiated. Zero disables this functionality.
BATTERYLEVELis the percentage of the remaining battery life which should be kept for the shut down sequence.
- The functionality of the
MINUTESdirective should be clear by now.
NOLOGON sets the timeout/percentage/minutes when the
/etc/nologin file is created. I choose to disable it in this example, for usually the user of a workstation is right in front of the box (if it’s running) and should therefore have the freedom to decide what to do. (Saving open documents would be a great idea!)
ANNOYDELAY are not effective if
NOLOGON is disabled, but mentioned for fututre reference. It should be clear that they control the first occurence and the period (in seconds) of the annoying “get of this machine, it’s running on batteries!” messages.