[Nut-upsuser] nut suddenly stopped working...

A.Lizard
Mon, 05 Mar 2007 22:48:55 -0000

As I said earlier, I got it working using the -u root option.

I'm running on the Debian distribution.

Upon upsmon -c fsd , it shuts down the workstation, but NOT the UPS. In
order to shut down both, I first tried Peter Selinger's shutdown patch for
init.d halt         :

note: program locations reflect where nut*.deb puts things in the Debian
filesystem.

if [ -f /etc/killpower ] ; then
     # if USB is already disabled, re-enable it.
     if [ ! -f /proc/bus/usb/devices ]; then
         echo "Mounting USB filesystem"
         mount -t usbfs usbfs /proc/bus/usb
     fi

     # hotplugging is probably off, so run driver as -u root
     echo "Killing the power, bye!"
     /lib/nut/newhidups -u root -k belkin-ups
     sleep 20

     # uh oh... the UPS power-off failed
     # you probably want to reboot here so you don't get stuck!
     # *** see the section on power races in shutdown.txt! ***
     echo "Rebooting."
     reboot
fi

I tried inserting it:
   # See if we need to cut the power.
         if [ "$INIT_HALT" = "POWEROFF" ] && [ -x
/etc/init.d/ups-monitor ]
         then
                 /etc/init.d/ups-monitor poweroff
fi

before and after /etc/init.d/ups-monitor poweroff.

I then tried changing the ups-monitor script:
original version:
  poweroff)
     flag=`sed -ne 's#^ *POWERDOWNFLAG *\(.*\)$#\1#p'
/etc/nut/upsmon.conf`
     wait_delay=`sed -ne 's#^ *POWEROFF_WAIT= *\(.*\)$#\1#p'
/etc/default/nut`
     if [ -f "$flag" ] ; then
       if /sbin/upsmon -K >/dev/null 2>&1 ; then
         echo "Shutting down the UPS ..."
         sleep 1
         # if /sbin/upsdrvctl shutdown ; then

I tried changing:
if /sbin/upsdrvctl -u root shutdown ; then

That failed. I then tried changing the above line to:
if /lib/nut/newhidups -a belkin-ups -k ; then

What I got was hundreds of iterations of "did not claim interface 0 before
use"

if /lib/nut/newhidups -a belkin-ups -k ; then

Note: /sbin/upsdrvctl -u root [command] belkin-ups
works for:
start
stop
but NOT shutdown

I decided that if things are to the point where I'm trying to modify
ups-monitor, it's time for me to ask for help.

thanks
A.Lizard
member The Internet Society (ISOC), The HTML Writers Guild.
"You can't have in a democracy various groups with arms - you have to
have
the state with a monopoly on power." Condoleeza Rice, US Secretary of State
Personal Website http://www.ecis.com/~alizard
business Website http://www.reptilelabs.com
backup address (if ALL else fails) alizard@gmail.com
PGP 8.0 key available by request or keyserver. Download PGP from:
http://www.pgpi.org for e-mail privacy.
Disaster prep info: http://www.ecis.com/~alizard/y2k.html
***Looking for INTELLIGENT new technology public policy
alternatives?***               http://www.ecis.com/~alizard/technology.html