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?

    • Offizieller Beitrag

    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 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    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.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!