[Nut-upsuser] Delta UPS boxes

Jerome BENOIT jgmbenoit at mailsnare.net
Wed Sep 3 20:08:47 UTC 2008


Hello List,


>>
> If you read the 'shutdown.txt' in the doc, you find that this is a file
> 'creates the POWERDOWNFLAG file - usually /etc/killpower'
> And this is created by upsmon master.
> 
> http://eu1.networkupstools.org/doc/2.2.0/shutdown.html
> 
> This is the file that the shutdown script look for to power of the
> ups.
> 
> quote
> ----------------
>    if (test -f /etc/killpower)
>    then
>    	echo "Killing the power, bye!"
>    	/usr/local/ups/bin/upsdrvctl shutdown
> 
> 	sleep 120
> 
> 	# uh oh... the UPS poweroff failed!
> 	# you probably should reboot here to avoid getting stuck
> 	# *** see the section on power races below ***
>    fi
> ----------------
> unquote
> 

I read the 'shutdown.txt' before to send the email.
And I read this IfThenFi in the /etc/init.d/nut :

  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 ## <-----------------------------------------------
  log_daemon_msg "Shutting down the UPS ..."
  sleep 1
  if /sbin/upsdrvctl shutdown ; then
    sleep 5
    log_progress_msg "Waiting for UPS to cut the power"
    log_end_msg 0
  else
    log_progress_msg "Shutdown failed."
    log_progress_msg "Waiting for UPS batteries to run down"
    log_end_msg 0
  fi
  if [ "$wait_delay" ] ; then
    log_daemon_msg " (will reboot after $wait_delay) ..."
    sleep "$wait_delay"
    /etc/init.d/reboot stop
  fi
      else
        log_daemon_msg "Power down flag is not set (UPS shutdown not needed)"
      fi
    else
        if [ -z "$flag" ] ; then
    log_daemon_msg   "##########################################################"
    log_progress_msg "## POWERDOWNFLAG is not defined in /etc/nut/upsmon.conf ##"
    log_progress_msg "##                                                      ##"
    log_progress_msg "## Please read the Manual page upsmon.conf(5)           ##"
    log_progress_msg "##########################################################"
    log_end_msg 0
      fi
    fi
    ;;

I guess that /sbin/upsmon -K check something else, otherwise
there is a clear redundancy here.

upsmon does generate the $flag , but /sbin/upsmon -K responses FALSE :
I will try to dig this issue later.

Thanks,
Jerome 


-- 
Jerome BENOIT
jgmbenoit_at_mailsnare_dot_net



More information about the Nut-upsuser mailing list