[Nut-upsuser] POWERCOM-UPS-USB : UPS Shutdown

Roger Price roger at rogerprice.org
Thu May 18 09:55:10 UTC 2017


On Wed, 17 May 2017, Dinow Hsieh wrote:

> ----------------------------------------------------------------------------------------
> CC. Does a Ubuntu user with no xterm window open see the message as part of
> the
> 
> ==> The root and remote user(ssh-putty) get the broadcasting message all
> from terminal-window

Since all the users have xterm access, there's no problem.

To get back to your original problem that the delayed shutdown of the UPS 
did not happen, and that the power outlets were not disconnected.

> NUT 2.7.4 includes file .../scripts/systemd/nutshutdown . Does Ubunti
> install this?

> ==> Yes. Ubuntu haved installed this as below contents

> dinow-All-Series:/lib/systemd/system-shutdown$ cat nutshutdown
> #!/bin/sh
> /sbin/upsmon -K >/dev/null 2>&1 && /sbin/upsdrvctl shutdown

It would be interesting to know if this script is really executed on a 
system shutdown.  Try adding line

    logger -t upsdrvctl "Calling for delated UPS shutdown"

The difficulty is that the NUT script is called very late when logging is 
probably no longer possible.  For this reason, I don't use the NUT 
nutshutdown script.  I prefer a systemd service unit

   # nut-delayed-ups-shutdown.service

   [Unit]
   Description=Initiate delayed UPS shutdown
   Before=umount.target
   DefaultDependencies=no

   [Service]
   Type=oneshot
   ExecStart=/usr/bin/logger -t upsdrvctl "nut-delayed-ups-shutdown.service
                                           calling upsdrvctl to shut down
                                           UPS unit"
   ExecStart=/usr/lib/ups/driver/upsdrvctl shutdown

   [Install]
   WantedBy=final.target

This service unit needs to be enabled with a command such as

   systemctl --system reenable
             /etc/systemd/system/nut-delayed-ups-shutdown.service

Roger



More information about the Nut-upsuser mailing list