Greetings!
I have successfully installed and configured nut package. All i want now is to power off ups. If i run upsmon -c fsd as root - everything goes fine, system and ups gracefully shutting down. If i unplug power cable from an ups, then system is down, but ups still on load. Any help would be appreciated.

Debian Lenny x86

ups.conf
[ippon]
   driver = megatec
   port = /dev/ttyS0
   desc = "Ippon Smart Power Pro 1000

upsd.conf
ACL all 0.0.0.0/0
ACL localhost 127.0.0.1/32
ACCEPT localhost
REJECT all

upsd.users
[monuser]
password  = pass
allowfrom = localhost
upsmon master
actions = set
instcmds = ALL

upsmon.conf
MONITOR ip...@localhost 1 monuser pass master
MINSUPPLIES 1
SHUTDOWNCMD "/sbin/shutdown -h now"
NOTIFYCMD /sbin/upssched
POLLFREQ 5
POLLFREQALERT 5
HOSTSYNC 15
DEADTIME 15
POWERDOWNFLAG /etc/killpower
NOTIFYFLAG ONLINE    SYSLOG+WALL
NOTIFYFLAG ONBATT    SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT    SYSLOG+WALL+EXEC
NOTIFYFLAG FSD        SYSLOG+WALL
NOTIFYFLAG COMMOK    SYSLOG+WALL
NOTIFYFLAG COMMBAD    SYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWN    SYSLOG+WALL
NOTIFYFLAG REPLBATT    SYSLOG+WALL+EXEC
NOTIFYFLAG NOCOMM    SYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENT    SYSLOG+WALL
RBWARNTIME 43200
NOCOMMWARNTIME 300
FINALDELAY 5

upsshed.conf
CMDSCRIPT /etc/nut/upssched-cmd
PIPEFN /var/run/nut/upssched.pipe
LOCKFN /var/run/nut/upssched.lock
AT ONBATT ip...@localhost START-TIMER fsd 30 #for testing
AT ONLINE ip...@localhost CANCEL-TIMER fsd

upsshed-cmd
#!/bin/sh
MSG="The UPS is running on battery about 2 minutes, doing force shutdown"

case $1 in
   fsd)
       logger -t upssched-cmd $MSG
       /sbin/upsmon -c fsd
       ;;
   *)
       logger -t upssched-cmd "ERROR!! $0 Unrecognized command: $1"
   ;;
esac

crw-rw----  1 root nut       4,  64 Июн 19 11:58 ttyS0
crw-rw----  1 root nut       4,  65 Июн 19 11:41 ttyS1
crw-rw----  1 root dialout   4,  66 Июн 19 11:41 ttyS2
crw-rw----  1 root dialout   4,  67 Июн 19 11:41 ttyS3

wcc:/var/run/nut# ls -la
итого 20
drwxrwx--- 2 root nut  4096 Июн 19 11:41 .
drwxr-xr-x 5 root root 4096 Июн 19 11:41 ..
srw-rw---- 1 nut  nut     0 Июн 19 11:41 megatec-ippon
-rw-r--r-- 1 nut  nut     5 Июн 19 11:41 megatec-ippon.pid
-rw-r--r-- 1 nut  nut     5 Июн 19 11:41 upsd.pid
-rw-r--r-- 1 root root    5 Июн 19 11:41 upsmon.pid

wcc:/var/run/nut# cat /etc/init.d/halt | grep -v "#"
NETDOWN=yes
PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ -f /etc/default/halt ] && . /etc/default/halt
. /lib/lsb/init-functions
do_stop () {
   if [ "$INIT_HALT" = "" ]
   then
       case "$HALT" in
         [Pp]*)
           INIT_HALT=POWEROFF
           ;;
         [Hh]*)
           INIT_HALT=HALT
           ;;
         *)
           INIT_HALT=POWEROFF
           ;;
       esac
   fi
   if (test -f /etc/killpower)
   then
   echo "Killing the power, bye!"
   /sbin/upsdrvctl shutdown
   sleep 120
   fi
   if [ "$INIT_HALT" = "POWEROFF" ] && [ -x /etc/init.d/ups-monitor ]
   then
       /etc/init.d/ups-monitor poweroff
   fi

   hddown="-h"
   if grep -qs '^md.*active' /proc/mdstat
   then
       hddown=""
   fi

   poweroff="-p"
   if [ "$INIT_HALT" = "HALT" ]
   then
       poweroff=""
   fi

   netdown="-i"
   if [ "$NETDOWN" = "no" ]; then
       netdown=""
   fi

   log_action_msg "Will now halt"
   halt -d -f $netdown $poweroff $hddown
}

case "$1" in
 start)
   ;;
 restart|reload|force-reload)
   echo "Error: argument '$1' not supported" >&2
   exit 3
   ;;
 stop)
   do_stop
   ;;
 *)
   echo "Usage: $0 start|stop" >&2
   exit 3
   ;;
esac
:



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

Reply via email to