Subject: UPS setup advice sought
To: None <current-users@netbsd.org>
From: Sean Davis <dive-nb@endersgame.net>
List: current-users
Date: 09/12/2004 23:33:03
(this is going to current-users since I am not subscribed to netbsd-users,
and all the machines in question are running current.)

I have an APC Smart-UPS 1500VA. It's currently running two NetBSD/sparc64
boxes and two NetBSD/i386 boxes. What I need to do is:
1) setup some daemon (be it apcupsd or ups-nut, I have minimal experience
   with apcupsd, none with ups-nut) so that all four machines cleanly
   shutdown if the power goes out for the UPS to drain to its shutoff point
   (according to apcaccess, after a recalibration, I should get roughly 14
   minutes at the current UPS load level)
2) more importantly, I need the machines to come back up upon power
   restoration in a certain order:
   1) The Ultra 1, which is the ipnat/ipf/dhcp/dns machine
   2) The p3 650, which is the machine connected to the UPS, and my NFS
      server
   3) the Ultra 5 and p3 600. Which of these two comes back first doesn't
      matter.

I originally tried something in netstart.local to call a script I wrote that
would wait until the NFS server responded to pings, then sleep for sixty
seconds (so that quotacheck can run, and the NFS server can finish booting).
This worked when I tested it by hand, but when testing it with a reboot, I
discovered that netstart.local happens before the machines get their
addresses via DHCP, thus, it is not the right place.

Does anyone else have a similar setup, and have any suggestions to offer?

Also... apcupsd in pkgsrc requires SHM, and I'm assuming other SYSV options
- I get a bad system call (core dumped) when trying to run it on any of the
other machines, even if they have SYSVSHM in the kernel. According to
everything I've read about apcupsd, it should be using pthreads, not
SYSVSHM, but for some reason NetBSD pkgsrc forces it to use SYSVSHM.

This would not be so much of an issue if a freshly built NetBSD/sparc64
kernel didn't panic on boot on my U5... so I can't just toss a new kernel
with all the SYSV options in. And I'm reluctant to do so anyway: apcupsd
should not need SHM, it should be using pthreads.

Would ups-nut be a better solution? What is the best way (dirty hacks are
fine with me as long as they get the machines up in the proper order, in
this case) to ensure that the Ultra 5 & p3 600 wait until the NFS server is
booted fully before continuing to boot (essentially, before they try to mount
everything...)

TIA,

-Sean

--
/~\ The ASCII
\ / Ribbon Campaign                   Sean Davis
 X  Against HTML                       aka dive
/ \ Email!