clifford64
Explorer
- Joined
- Aug 18, 2019
- Messages
- 87
I created a custom shutdown script to be run by the UPS service in TrueNAS Scale so it will perform the following steps.
Steps 1 and 2 work without issues. However, step 3 doesn't appear to work properly I have the UPS set to power off, but it doesn't seem to power off. It seems to reboot.
I have a Cyber power CP1500AVRLCDa. I am accomplishing this by setting the UPS settings in Truenas to start a count down as soon as battery power starts. If the system is on battery for more than 2 minutes (will adjust later after testing is complete), then it will begin the shutdown process. The shutdown process points to the custom bash script that runs shuts down the VMs and esxi host. When all that is complete, it then runs the same shutdown command of "/sbin/shutdown -P now" that the normal UPS service would have run. To prevent the UPS from shutting down while it is shutting down the ESXi VMs and host, I set "offdelay=300" and ondelay="360". Once the systems were shut down, the UPS LCD would show "d 5min" or the count down for the actual shutdown. It would then show in seconds counting down from 60. Once it hit 0, it would start another countdown of "u 60sec". After that second countdown hits zero, the UPS turns back on.
To perform this test, I am unplugging the UPS from the wall to simulate a power failure. So it would not be able to sense power has been restored and should not be turning back on.
Anyone run into anything like this or have any idea what might be going on and how I can get it to shut down the UPS during power off so it is restored when power comes back?
- Power down VMs on an ESXi host and then power down the ESXi host
- Power down the TrueNAS host itself
- Power off the UPS.
Steps 1 and 2 work without issues. However, step 3 doesn't appear to work properly I have the UPS set to power off, but it doesn't seem to power off. It seems to reboot.
I have a Cyber power CP1500AVRLCDa. I am accomplishing this by setting the UPS settings in Truenas to start a count down as soon as battery power starts. If the system is on battery for more than 2 minutes (will adjust later after testing is complete), then it will begin the shutdown process. The shutdown process points to the custom bash script that runs shuts down the VMs and esxi host. When all that is complete, it then runs the same shutdown command of "/sbin/shutdown -P now" that the normal UPS service would have run. To prevent the UPS from shutting down while it is shutting down the ESXi VMs and host, I set "offdelay=300" and ondelay="360". Once the systems were shut down, the UPS LCD would show "d 5min" or the count down for the actual shutdown. It would then show in seconds counting down from 60. Once it hit 0, it would start another countdown of "u 60sec". After that second countdown hits zero, the UPS turns back on.
To perform this test, I am unplugging the UPS from the wall to simulate a power failure. So it would not be able to sense power has been restored and should not be turning back on.
Anyone run into anything like this or have any idea what might be going on and how I can get it to shut down the UPS during power off so it is restored when power comes back?
Code:
Init SSL without certificate database battery.charge: 49 battery.charge.low: 10 battery.charge.warning: 20 battery.mfr.date: CPS battery.runtime: 261 battery.runtime.low: 300 battery.type: PbAcid battery.voltage: 26.6 battery.voltage.nominal: 24 device.mfr: CPS device.model: CP1500AVRLCDa device.serial: CXEJQ2009081 device.type: ups driver.name: usbhid-ups driver.parameter.offdelay: 300 driver.parameter.ondelay: 360 driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.parameter.synchronous: auto driver.version: 2.8.0 driver.version.data: CyberPower HID 0.6 driver.version.internal: 0.47 driver.version.usb: libusb-1.0.26 (API: 0x1000109) input.voltage: 120.0 input.voltage.nominal: 120 output.voltage: 120.0 ups.beeper.status: enabled ups.delay.shutdown: 300 ups.delay.start: 360 ups.load: 51 ups.mfr: CPS ups.model: CP1500AVRLCDa ups.productid: 0501 ups.realpower.nominal: 900 ups.serial: CXEJQ2009081 ups.status: OL CHRG LB ups.test.result: No test initiated ups.timer.shutdown: -60 ups.timer.start: -60 ups.vendorid: 0764