Min Wang
2016-May-09 02:42 UTC
[Nut-upsuser] cyberpower ups need to manully turn on the switch
Hi centos 6.3 uses traditional SysV script ( not systemctl) here is the /etc/init.d/ups ( script) assuming it similar to nutshutdown # more /etc/init.d/ups #! /bin/bash # # ups: Starts the Network UPS Tools # # chkconfig: - 26 74 # description: Network UPS Tools is a collection of programs which provide a common \ # interface for monitoring and administering UPS hardware. # processname: upsd # config: /etc/ups/ # config: /etc/sysconfig/ups # ### BEGIN INIT INFO # Provides: ups # Required-Start: $syslog $network $named # Required-Stop: $local_fs # Default-Stop: 0 1 6 # Short-Description: Starts the Network UPS tools # Description: Network UPS Tools is a collection of programs which provide a common \ # interface for monitoring and administering UPS hardware. ### END INIT INFO # Source function library. if [ -f /etc/init.d/functions ]; then . /etc/init.d/functions elif [ -f /etc/rc.d/init.d/functions ]; then . /etc/rc.d/init.d/functions else exit 0 fi # Get config. if [ -f /etc/sysconfig/ups ]; then . /etc/sysconfig/ups else SERVER="no" fi start() { if [ "$SERVER" = "yes" ]; then echo -n $"Starting UPS driver controller: " daemon /sbin/upsdrvctl start > /dev/null 2>&1 && success || failure RETVAL=$? echo prog="upsd" echo -n $"Starting $prog: " daemon /usr/sbin/upsd $UPSD_OPTIONS > /dev/null 2>&1 && success || failure if [ "$RETVAL" = 0 ]; then RETVAL=$? fi echo echo -n $"Starting UPS monitor (master): " daemon /usr/sbin/upsmon > /dev/null 2>&1 && success || failure if [ "$RETVAL" = 0 ]; then RETVAL=$? fi echo else echo -n $"Starting UPS monitor (slave): " daemon /usr/sbin/upsmon > /dev/null 2>&1 && success || failure RETVAL=$? echo fi [ "$RETVAL" = 0 ] && touch /var/lock/subsys/ups } stop() { echo -n $"Stopping UPS monitor: " killproc upsmon RETVAL=$? echo if [ "$SERVER" = "yes" ]; then prog="upsd" echo -n $"Stopping $prog: " killproc upsd > /dev/null 2>&1 && success || failure if [ "$RETVAL" = 0 ]; then RETVAL=$? fi echo echo -n $"Shutting down upsdrvctl: " /sbin/upsdrvctl stop > /dev/null 2>&1 && success || failure if [ "$RETVAL" = 0 ]; then RETVAL=$? fi echo fi [ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/ups } restart() { stop start } reload() { # FIXME: upsd and upsmon always return 0 # => can't tell if reload was successful if [ "$SERVER" = "yes" ]; then action "Reloading upsd:" /usr/sbin/upsd -c reload RETVAL=$? fi action "Reloading upsmon:" /usr/sbin/upsmon -c reload if [ "$RETVAL" = 0 ]; then RETVAL=$? fi } # See how we are called. case "$1" in start) start ;; stop) stop ;; restart) restart ;; try-restart) [ -f /var/lock/subsys/ups ] && restart || : ;; reload) reload ;; force-reload) restart ;; status) if [ "$SERVER" = "yes" ]; then status upsd fi status upsmon ;; *) echo $"Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}" RETVAL=3 esac exit $RETVAL min On Sun, May 8, 2016 at 3:16 AM, Roger Price <roger at rogerprice.org> wrote:> On Sat, 7 May 2016, Min Wang wrote: > > I am using centos 6.3, and nut-2.6.5-2.el6.x86_64. >> could you explain why not sending "a delayed command to the UPS to turn >> it off" may cause that issue? >> > > You need to stop the UPS from beeping. Only then can you get a clear > restart when power returns. To stop the UPS from beeping, you must turn it > off. > > ups.delay.shutdown: 20 >> ups.delay.start: 30 >> >> is it something related? >> > > Yes, they are related: the two ups.delay values are used by the program > which turns off the UPS. This program is called by by script nutshutdown > which is part of the nut package. Do you have this script installed? > > What does command "systemctl status nutshutdown" report? > > Roger > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser >-- http://www.comrite.com Yellow pages, Ads and Search http://www.meidongnet.com News, Ads, Free Online dating, Games for Chinese Community in NY, NJ, PA -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20160508/f6e6e104/attachment.html>
Roger Price
2016-May-09 10:00 UTC
[Nut-upsuser] cyberpower ups need to manully turn on the switch
On Sun, 8 May 2016, Min Wang wrote:> Hi > centos 6.3 uses traditional SysV script ( not systemctl) > > here is the /etc/init.d/ups ( script) assuming it similar to nutshutdownFile /etc/init.d/ups is an administrative script which is used to set up the nut daemon - I was looking for a run-time script called by systemd, but since there is no systemd, could you run the attached Bash script which will prepare a report on your NUT configuration for you to post. Perhaps this will show what is not sending the "upsdrvctl shutdown" order. Check the address C="/usr/sbin/upssched-cmd" You may not have a file upssched-cmd, or CentOS may put this somewhere else. Roger #!/bin/bash # Report NUT configuration # Remove comments, blank lines and passwords C="/usr/sbin/upssched-cmd" # Please check !! D="/etc/ups" # Where does CentOS hide the UPC configuration? T=`mktemp` # Temporary file R="/tmp/NUT.report" # T without passwords echo -e " NUT configuration `date --utc '+%Y-%m-%d %T %Z'`" > $T # Configuration files, remove comments and empty lines RE="^#.*$|^[[:space:]]*$" for F in $D/nut.conf $D/ups.conf $D/upsd.conf $D/upsd.users $D/upsmon.conf $D/upssched.conf $C do echo -e "\n ########### $F ###########" >> $T if [[ -f "$F" && -r "$F" ]] ; then cat $F | grep -v -E "$RE" >> $T else echo "Cannot access $F" >> $T fi done # Get upsd rules out of hosts.allow HA="/etc/hosts.allow" echo -e "\n ########### $HA ###########" >> $T if [[ -f "$HA" && -r "$HA" ]] ; then grep -v -E "^#.*$|^[[:space:]]*$" < $HA | while read L || [[ -n "$L" ]] do if [[ "$L" =~ ^.*(upsd.*)$ ]] then TRIM=$L # Bash removes unwanted white space echo $TRIM >> $T fi done else echo "Cannot access $HA" >> $T fi # Processes echo -e "\n ########### ps aux ###########" >> $T ps aux | grep "/ups" | grep -v "grep" >> $T # Ownership and permissions echo -e "\n ########### Ownership and permissions ###########" >> $T ls -alF /usr/sbin/ups* >> $T ls -alF /etc/ups/* | grep -v -E "~|stats|set" >> $T # Remove password from report L=`grep password $T | tr -d " \t\n\r"` if [[ "$L" =~ ^.*=(.+)$ ]] then PASS="${BASH_REMATCH[1]}" sed "s/$PASS/*********/" < $T > $R else # Could not find a password cat $T > $R fi echo "I have created file \"$R\" with a summary of your NUT configuration." echo "Passwords have been removed." rm $T; exit
Min Wang
2016-May-09 23:55 UTC
[Nut-upsuser] cyberpower ups need to manully turn on the switch
HI in centos: C="/usr/bin/upssched-cmd" here is the output of that file: # more /tmp/NUT.report NUT configuration 2016-05-10 03:02:20 UTC ########### /etc/ups/nut.conf ########### MODE=netserver ########### /etc/ups/ups.conf ########### [cyberpower] #driver = powerpanel #port = auto driver = usbhid-ups port = auto vendorid = 0764 desc = " My main server 19" ########### /etc/ups/upsd.conf ########### LISTEN 127.0.0.1 3493 LISTEN 192.168.1.19 3493 LISTEN ::1 3493 ########### /etc/ups/upsd.users ########### [admin] password = ********* actions = SET instcmds = ALL [upsmon] password = ********* upsmon master [upsmonslave] password = ********* upsmon slave ########### /etc/ups/upsmon.conf ########### MONITOR cyberpower at localhost 1 upsmon ********* master MINSUPPLIES 1 SHUTDOWNCMD "/sbin/shutdown -hP +0" POLLFREQ 5 POLLFREQALERT 5 HOSTSYNC 15 DEADTIME 15 POWERDOWNFLAG /etc/killpower NOTIFYMSG LOWBATT "UPS %s battery is low" NOTIFYMSG FSD "UPS %s: forced shutdown in progress" NOTIFYMSG SHUTDOWN "Auto logout and shutdown proceeding" NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced" NOTIFYMSG NOCOMM "UPS %s is unavailable" NOTIFYMSG NOPARENT "upsmon parent process died - shutdown impossible" NOTIFYFLAG LOWBATT SYSLOG+WALL NOTIFYFLAG SHUTDOWN SYSLOG+WALL NOTIFYFLAG REPLBATT SYSLOG+WALL NOTIFYFLAG NOCOMM SYSLOG+WALL NOTIFYFLAG NOPARENT SYSLOG+WALL RBWARNTIME 43200 NOCOMMWARNTIME 300 FINALDELAY 5 ########### /etc/ups/upssched.conf ########### CMDSCRIPT /usr/bin/upssched-cmd ########### /usr/bin/upssched-cmd ########### case $1 in upsgone) logger -t upssched-cmd "The UPS has been gone for awhile" ;; *) logger -t upssched-cmd "Unrecognized command: $1" ;; esac ########### /etc/hosts.allow ########### ########### ps aux ########### nut 2651 0.0 0.0 43396 1116 ? Ss May07 0:08 /usr/sbin/upsd root 2654 0.0 0.0 39116 1172 ? Ss May07 0:00 /usr/sbin/upsmon nut 2655 0.0 0.0 41208 1300 ? S May07 0:03 /usr/sbin/upsmon ########### Ownership and permissions ########### -rwxr-xr-x. 1 root root 64824 May 15 2013 /usr/sbin/upsd* -rwxr-xr-x. 1 root root 44296 May 15 2013 /usr/sbin/upsmon* -rwxr-xr-x. 1 root root 28816 May 15 2013 /usr/sbin/upssched* -rw-r-----. 1 root nut 1554 Mar 22 2014 /etc/ups/nut.conf -rw-r-----. 1 root nut 3797 Mar 22 2014 /etc/ups/ups.conf -rw-r-----. 1 root nut 2807 Mar 22 2014 /etc/ups/upsd.conf -rw-r-----. 1 root nut 2294 May 7 14:28 /etc/ups/upsd.users -rw-r-----. 1 root root 2131 Mar 22 2014 /etc/ups/upsd.users.orig -rw-r-----. 1 root nut 11948 May 11 2014 /etc/ups/upsmon.conf -rw-r-----. 1 root root 11913 Mar 22 2014 /etc/ups/upsmon.conf.orig -rw-r-----. 1 root nut 3891 May 15 2013 /etc/ups/upssched.conf min On Mon, May 9, 2016 at 6:00 AM, Roger Price <roger at rogerprice.org> wrote:> On Sun, 8 May 2016, Min Wang wrote: > > Hi >> centos 6.3 uses traditional SysV script ( not systemctl) >> >> here is the /etc/init.d/ups ( script) assuming it similar to nutshutdown >> > > File /etc/init.d/ups is an administrative script which is used to set up > the nut daemon - I was looking for a run-time script called by systemd, but > since there is no systemd, could you run the attached Bash script which > will prepare a report on your NUT configuration for you to post. Perhaps > this will show what is not sending the "upsdrvctl shutdown" order. > > Check the address C="/usr/sbin/upssched-cmd" You may not have a file > upssched-cmd, or CentOS may put this somewhere else. > > Roger > > #!/bin/bash > # Report NUT configuration > # Remove comments, blank lines and passwords > > C="/usr/sbin/upssched-cmd" # Please check !! > D="/etc/ups" # Where does CentOS hide the UPC configuration? > T=`mktemp` # Temporary file > R="/tmp/NUT.report" # T without passwords > > echo -e " NUT configuration `date --utc '+%Y-%m-%d %T %Z'`" > > $T > > # Configuration files, remove comments and empty lines > RE="^#.*$|^[[:space:]]*$" > for F in $D/nut.conf $D/ups.conf $D/upsd.conf $D/upsd.users $D/upsmon.conf > $D/upssched.conf $C > do echo -e "\n ########### $F ###########" >> $T > if [[ -f "$F" && -r "$F" ]] ; then > cat $F | grep -v -E "$RE" >> $T > else echo "Cannot access $F" >> $T > fi > done > # Get upsd rules out of hosts.allow > HA="/etc/hosts.allow" > echo -e "\n ########### $HA ###########" >> $T > if [[ -f "$HA" && -r "$HA" ]] ; then > grep -v -E "^#.*$|^[[:space:]]*$" < $HA | > while read L || [[ -n "$L" ]] > do if [[ "$L" =~ ^.*(upsd.*)$ ]] > then TRIM=$L # Bash removes unwanted white space > echo $TRIM >> $T > fi > done > else echo "Cannot access $HA" >> $T > fi > > # Processes > echo -e "\n ########### ps aux ###########" >> $T > ps aux | grep "/ups" | grep -v "grep" >> $T > > # Ownership and permissions > echo -e "\n ########### Ownership and permissions ###########" >> $T > ls -alF /usr/sbin/ups* >> $T > ls -alF /etc/ups/* | grep -v -E "~|stats|set" >> $T > > # Remove password from report > L=`grep password $T | tr -d " \t\n\r"` > if [[ "$L" =~ ^.*=(.+)$ ]] > then PASS="${BASH_REMATCH[1]}" > sed "s/$PASS/*********/" < $T > $R > else # Could not find a password > cat $T > $R > fi > > echo "I have created file \"$R\" with a summary of your NUT configuration." > echo "Passwords have been removed." > rm $T; > exit > > > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at lists.alioth.debian.org > http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser >-- http://www.comrite.com Yellow pages, Ads and Search http://www.meidongnet.com News, Ads, Free Online dating, Games for Chinese Community in NY, NJ, PA -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20160509/0565a2a1/attachment.html>