I am still not able to get the UPS to shutdown. Here is a list of rc0.d and the file I created to shutdown the UPS after umountroot mounts the filesystem read-only and before halt (halt seems to be a no op here. No code under the start case).

[EMAIL PROTECTED]:~$ cd /etc/rc0.d
[EMAIL PROTECTED]:/etc/rc0.d$ ls -l
total 4
lrwxrwxrwx 1 root root  13 2007-01-26 11:13 K01gdm -> ../init.d/gdm
lrwxrwxrwx 1 root root  17 2007-01-26 11:13 K01usplash -> ../init.d/usplash
lrwxrwxrwx 1 root root  17 2007-01-26 11:58 K19camserv -> ../init.d/camserv
lrwxrwxrwx 1 root root  15 2007-01-26 11:13 K19hplip -> ../init.d/hplip
lrwxrwxrwx 1 root root  15 2007-01-28 17:43 K19samba -> ../init.d/samba
lrwxrwxrwx 1 root root  14 2007-01-26 11:13 K20dbus -> ../init.d/dbus
lrwxrwxrwx 1 root root  13 2007-01-26 11:57 K20nut -> ../init.d/nut
lrwxrwxrwx 1 root root 21 2007-02-01 13:05 K20ups-monitor -> ../init.d/ups-monitor lrwxrwxrwx 1 root root 20 2007-01-26 11:13 K25hwclock.sh -> ../init.d/hwclock.sh lrwxrwxrwx 1 root root 20 2007-01-26 11:13 K50alsa-utils -> ../init.d/alsa-utils
lrwxrwxrwx 1 root root  17 2007-01-26 11:52 K91apache2 -> ../init.d/apache2
-rw-r--r-- 1 root root 355 2006-10-06 07:34 README
lrwxrwxrwx 1 root root 41 2007-01-26 11:13 S01linux-restricted-modules-common -> ../init.d/linux-restricted-modules-common lrwxrwxrwx 1 root root 22 2007-01-26 11:13 S15wpa-ifupdown -> ../init.d/wpa-ifupdown lrwxrwxrwx 1 root root 18 2007-01-26 11:13 S20sendsigs -> ../init.d/sendsigs
lrwxrwxrwx 1 root root  17 2007-01-26 11:13 S30urandom -> ../init.d/urandom
lrwxrwxrwx 1 root root 22 2007-01-26 11:13 S31umountnfs.sh -> ../init.d/umountnfs.sh lrwxrwxrwx 1 root root 18 2007-01-26 11:13 S40umountfs -> ../init.d/umountfs lrwxrwxrwx 1 root root 20 2007-01-26 11:13 S60umountroot -> ../init.d/umountroot lrwxrwxrwx 1 root root 22 2007-02-07 15:29 S89ups-shutdown -> ../init.d/ups-shutdown
lrwxrwxrwx 1 root root  14 2007-01-26 11:13 S90halt -> ../init.d/halt
[EMAIL PROTECTED]:/etc/rc0.d$ cd /etc/init.d
[EMAIL PROTECTED]:/etc/init.d$ cat ups-shutdown
#! /bin/sh
#
# nut - Script to Shutdown UPS if line power is lost & low battery

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin
NAME=ups-shutdown
DESC="UPS Shutdown"
DEFAULT=/etc/default/nut

[ -f $DEFAULT ] || exit 0
. $DEFAULT

upsdrvctl=/usr/local/ups/bin/upsdrvctl
log=">/dev/null 2>/dev/null"

case "$1" in

 start)
   echo -n "Starting $DESC:"
flag=`sed -ne 's#^ *POWERDOWNFLAG *\(.*\)$#\1#p' usr/local/ups/etc/upsmon.conf` wait_delay=`sed -ne 's#^ *POWEROFF_WAIT= *\(.*\)$#\1#p' /etc/default/nut`
   if [ -f "$flag" ] ; then
     if [ $upsdrvctl shutdown >/dev/null ] ; then
       echo -n "Waiting for UPS to cut the power"
       sleep 5
     else
       echo "Shutdown failed."
       echo -n "Waiting for UPS batteries to run down"
       sleep 10
     fi
     if [ "$wait_delay" ] ; then
       echo " (will reboot after $wait_delay) ..."
       sleep "$wait_delay"
       /etc/init.d/reboot
     fi
   else
     echo "Power down flag is not set (UPS shutdown not needed)"
   fi

   ;;

 stop)
   ;;

 *)
   N=/etc/init.d/$NAME
   echo "Usage: $N {start|stop}" >&2
   exit 1
   ;;

esac

exit 0
[EMAIL PROTECTED]:/etc/init.d$


_______________________________________________
Nut-upsuser mailing list
Nut-upsuser@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser

Reply via email to