<div dir="ltr">Hi<div><br></div><div>centos 6.3 uses traditional SysV script ( not systemctl)</div><div><br></div><div>here is the /etc/init.d/ups ( script) assuming it similar to nutshutdown</div><div><br></div><div><div># more /etc/init.d/ups </div><div><br></div><div>#! /bin/bash</div><div>#</div><div># ups: Starts the Network UPS Tools</div><div>#</div><div># chkconfig: - 26 74</div><div># description: Network UPS Tools is a collection of programs which provide a common \</div><div>#<span class="" style="white-space:pre">          </span>interface for monitoring and administering UPS hardware.</div><div># processname: upsd</div><div># config: /etc/ups/</div><div># config: /etc/sysconfig/ups</div><div>#</div><div>### BEGIN INIT INFO</div><div># Provides: ups</div><div># Required-Start: $syslog $network $named</div><div># Required-Stop: $local_fs</div><div># Default-Stop: 0 1 6</div><div># Short-Description: Starts the Network UPS tools</div><div># Description: Network UPS Tools is a collection of programs which provide a common \</div><div>#<span class="" style="white-space:pre">          </span>interface for monitoring and administering UPS hardware. </div><div>### END INIT INFO</div><div><br></div><div># Source function library.</div><div>if [ -f /etc/init.d/functions ]; then</div><div><span class="" style="white-space:pre">   </span>. /etc/init.d/functions</div><div>elif [ -f /etc/rc.d/init.d/functions ]; then</div><div><span class="" style="white-space:pre"> </span>. /etc/rc.d/init.d/functions</div><div>else</div><div><span class="" style="white-space:pre">    </span>exit 0</div><div>fi</div><div><br></div><div># Get config.</div><div>if [ -f /etc/sysconfig/ups ]; then</div><div><span class="" style="white-space:pre">      </span>. /etc/sysconfig/ups</div><div>else</div><div><span class="" style="white-space:pre">    </span>SERVER="no"</div><div>fi</div><div><br></div><div>start() {</div><div><span class="" style="white-space:pre">    </span>if [ "$SERVER" = "yes" ]; then</div><div><span class="" style="white-space:pre">         </span>echo -n $"Starting UPS driver controller: "</div><div><span class="" style="white-space:pre">              </span>daemon /sbin/upsdrvctl start > /dev/null 2>&1 && success || failure</div><div><span class="" style="white-space:pre">              </span>RETVAL=$?</div><div><span class="" style="white-space:pre">          </span>echo</div><div><br></div><div><span class="" style="white-space:pre">              </span>prog="upsd"</div><div><span class="" style="white-space:pre">              </span>echo -n $"Starting $prog: "</div><div><span class="" style="white-space:pre">              </span>daemon /usr/sbin/upsd $UPSD_OPTIONS > /dev/null 2>&1 && success || failure</div><div><span class="" style="white-space:pre">               </span>if [ "$RETVAL" = 0 ]; then</div><div><span class="" style="white-space:pre">                       </span>RETVAL=$?</div><div><span class="" style="white-space:pre">          </span>fi</div><div><span class="" style="white-space:pre">         </span>echo</div><div><br></div><div><span class="" style="white-space:pre">              </span>echo -n $"Starting UPS monitor (master): "</div><div><span class="" style="white-space:pre">               </span>daemon /usr/sbin/upsmon > /dev/null 2>&1 && success || failure</div><div><span class="" style="white-space:pre">           </span>if [ "$RETVAL" = 0 ]; then</div><div><span class="" style="white-space:pre">                       </span>RETVAL=$?</div><div><span class="" style="white-space:pre">          </span>fi</div><div><span class="" style="white-space:pre">         </span>echo</div><div><span class="" style="white-space:pre">       </span>else</div><div><span class="" style="white-space:pre">               </span>echo -n $"Starting UPS monitor (slave): "</div><div><span class="" style="white-space:pre">                </span>daemon /usr/sbin/upsmon > /dev/null 2>&1 && success || failure</div><div><span class="" style="white-space:pre">           </span>RETVAL=$?</div><div><span class="" style="white-space:pre">          </span>echo</div><div><span class="" style="white-space:pre">       </span>fi</div><div><br></div><div><span class="" style="white-space:pre">        </span>[ "$RETVAL" = 0 ] && touch /var/lock/subsys/ups</div><div>}</div><div><br></div><div>stop() {</div><div><span class="" style="white-space:pre">  </span>echo -n $"Stopping UPS monitor: "</div><div><span class="" style="white-space:pre">        </span>killproc upsmon</div><div><span class="" style="white-space:pre">    </span>RETVAL=$?</div><div><span class="" style="white-space:pre">  </span>echo</div><div><br></div><div><span class="" style="white-space:pre">      </span>if [ "$SERVER" = "yes" ]; then</div><div><span class="" style="white-space:pre">         </span>prog="upsd"</div><div><span class="" style="white-space:pre">              </span>echo -n $"Stopping $prog: "</div><div><span class="" style="white-space:pre">              </span>killproc upsd > /dev/null 2>&1 && success || failure</div><div><span class="" style="white-space:pre">             </span>if [ "$RETVAL" = 0 ]; then</div><div><span class="" style="white-space:pre">                       </span>RETVAL=$?</div><div><span class="" style="white-space:pre">          </span>fi</div><div><span class="" style="white-space:pre">         </span>echo</div><div><br></div><div><span class="" style="white-space:pre">              </span>echo -n $"Shutting down upsdrvctl: "</div><div><span class="" style="white-space:pre">             </span>/sbin/upsdrvctl stop > /dev/null 2>&1 && success || failure</div><div><span class="" style="white-space:pre">              </span>if [ "$RETVAL" = 0 ]; then</div><div><span class="" style="white-space:pre">                       </span>RETVAL=$?</div><div><span class="" style="white-space:pre">          </span>fi</div><div><span class="" style="white-space:pre">         </span>echo</div><div><span class="" style="white-space:pre">       </span>fi</div><div><span class="" style="white-space:pre"> </span>[ "$RETVAL" = 0 ] && rm -f /var/lock/subsys/ups</div><div>}</div><div><br></div><div>restart() {</div><div><span class="" style="white-space:pre">       </span>stop</div><div><span class="" style="white-space:pre">       </span>start</div><div>}</div><div><br></div><div>reload() {</div><div><span class="" style="white-space:pre">    </span># FIXME: upsd and upsmon always return 0</div><div><span class="" style="white-space:pre">   </span># => can't tell if reload was successful</div><div><span class="" style="white-space:pre">    </span>if [ "$SERVER" = "yes" ]; then</div><div><span class="" style="white-space:pre">         </span>action "Reloading upsd:" /usr/sbin/upsd -c reload</div><div><span class="" style="white-space:pre">                </span>RETVAL=$?</div><div><span class="" style="white-space:pre">  </span>fi</div><div><span class="" style="white-space:pre"> </span>action "Reloading upsmon:" /usr/sbin/upsmon -c reload</div><div><span class="" style="white-space:pre">    </span>if [ "$RETVAL" = 0 ]; then</div><div><span class="" style="white-space:pre">               </span>RETVAL=$?</div><div><span class="" style="white-space:pre">  </span>fi</div><div>}</div><div><br></div><div># See how we are called.</div><div>case "$1" in</div><div><span class="" style="white-space:pre">    </span>start)</div><div><span class="" style="white-space:pre">             </span>start ;;</div><div><br></div><div><span class="" style="white-space:pre">  </span>stop)</div><div><span class="" style="white-space:pre">              </span>stop ;;</div><div><br></div><div><span class="" style="white-space:pre">   </span>restart)</div><div><span class="" style="white-space:pre">           </span>restart ;;</div><div><br></div><div><span class="" style="white-space:pre">        </span>try-restart)</div><div><span class="" style="white-space:pre">               </span>[ -f /var/lock/subsys/ups ] && restart || :</div><div><span class="" style="white-space:pre">                </span>;;</div><div><br></div><div><span class="" style="white-space:pre">        </span>reload)</div><div><span class="" style="white-space:pre">            </span>reload ;;</div><div><br></div><div><span class="" style="white-space:pre"> </span>force-reload)</div><div><span class="" style="white-space:pre">              </span>restart ;;</div><div><br></div><div><span class="" style="white-space:pre">        </span>status)</div><div><span class="" style="white-space:pre">            </span>if [ "$SERVER" = "yes" ]; then</div><div><span class="" style="white-space:pre">                 </span>status upsd</div><div><span class="" style="white-space:pre">                </span>fi</div><div><span class="" style="white-space:pre">         </span>status upsmon</div><div><span class="" style="white-space:pre">              </span>;;</div><div><br></div><div><span class="" style="white-space:pre">        </span>*)</div><div><span class="" style="white-space:pre">         </span>echo $"Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}"</div><div><span class="" style="white-space:pre">            </span>RETVAL=3</div><div>esac</div><div><br></div><div>exit $RETVAL</div></div><div><br></div><div><br></div><div>min</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 8, 2016 at 3:16 AM, Roger Price <span dir="ltr"><<a href="mailto:roger@rogerprice.org" target="_blank">roger@rogerprice.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sat, 7 May 2016, Min Wang wrote:<br>
<br>
</span><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am using centos 6.3, and nut-2.6.5-2.el6.x86_64.<br>
could you explain why not sending "a delayed command to the UPS to turn it off" may cause that issue?  <br>
</blockquote>
<br></span>
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.<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
ups.delay.shutdown: 20<br>
ups.delay.start: 30<br>
<br>
is it something related?<br>
</blockquote>
<br></span>
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?<br>
<br>
What does command "systemctl status nutshutdown" report?<span class="HOEnZb"><font color="#888888"><br>
<br>
Roger</font></span><br>_______________________________________________<br>
Nut-upsuser mailing list<br>
<a href="mailto:Nut-upsuser@lists.alioth.debian.org">Nut-upsuser@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser" rel="noreferrer" target="_blank">http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><a href="http://www.comrite.com" target="_blank">http://www.comrite.com</a><br>Yellow pages, Ads and Search <br><br><a href="http://www.meidongnet.com" target="_blank">http://www.meidongnet.com</a><br>News, Ads, Free Online dating, Games for Chinese Community in NY, NJ, PA</div>
</div>