Running a script to shutdown additional servers on UPS?

    • Running a script to shutdown additional servers on UPS?

      I have a Cyberpower CP1000PFCLCD UPS that is linked to my OMV box. I would like to have my system run a script when shutting down due to a power outage or UPS low battery. The main purpose of the script would be to execute a few additional commands to turn off other machines that are also powered by the UPS but not connected directly to it.

      I initially tried setting this up by installing a CyberPower provided UPS linux utility (pwrstat) which does allow you to configure a set of commands that can automatically run when the system is shutting down due while on battery backup. However the utility is unable to communicate with the UPS.

      The NUT client on the other hand works perfect. So assuming I stick with NUT, how do I configure the system to run some logic on power failure. Do I put a little script in rc0.d that tests certain parameters from the output of 'upsc ups' or is there a simpler / more elegant way to do things?
    • IF you can have multiple NOTIFYCMD in upsmon.conf (haven't tried), you could modify /etc/nut/upsmon.conf and add NOTIFYCMD /path/to/my/script. Unfortunately, the ups plugin would overwrite the change.
      omv 4.0.6 arrakis | 64 bit | 4.12 backports kernel | omvextrasorg 4.1.0
      omv-extras.org plugins source code and issue tracker - github.com/OpenMediaVault-Plugin-Developers

      Please don't PM for support... Too many PMs!
    • I asked the same exact question in THIS post.

      I just order my UPS (the same exact one!) and it has not arrived yet but I was thinking of having the UPS shut down server A and then run on server B to ping server A and if it does not get a response then to shut it self down. Might auto shut down if a network problem so not sure if it is the most robust.

      I'll let you know what I am able to put together once I get the UPS.
      omv 3.0.73 (Erasmus) | 64 bit
      NAS Details: New Server Build