hotio Posted October 3, 2019 Share Posted October 3, 2019 (edited) I've been messing with this for quite a while (or several hours atleast)...it seems that unraid's config page for the UPS is focused on USB attached devices. However I wanted to shutdown my UPS when using the Network Management Card and not USB. 1) Set the option 'Turn off UPS after shutdown' to 'No'. This only works when using a direct attached ups with usb or maybe serial. 2) Add the command "sed -i 's/\/sbin\/apcupsd/\/sbin\/apcupsd -p/g' /etc/rc.d/rc.apcupsd" to your go file "/boot/config/go". 3) reboot This will start "/sbin/apcupsd" with the -p flag (aka --kill-on-powerfail), this will instruct the ups to shutdown before the system is given the shutdown command. Since most SmartUPS's can have a shutdown delay set, this isn't a problem. Because the command is sent before shutting down the system, the network is still up and the ups is able to receive the request. Setting 'Turn off UPS after shutdown' to 'Yes', would execute "/etc/apcupsd/apccontrol killpower" at the very end of the shutdown sequence when the network is already down. Maybe there's some room for improvement here in how unraid handles this/does the config? Edited October 3, 2019 by hotio 1 Quote Link to comment
Goldfire Posted June 1, 2020 Share Posted June 1, 2020 On 10/3/2019 at 11:48 PM, hotio said: I've been messing with this for quite a while (or several hours atleast)...it seems that unraid's config page for the UPS is focused on USB attached devices. However I wanted to shutdown my UPS when using the Network Management Card and not USB... Oh God, thank you. I've been looking on and off over the years for a fix to this. After looking for and testing different things for a lot of that time, I finally made a topic back in mid 2019, but no one had a fix (let alone a reply): I gave your fix a go, and it worked perfectly after a quick test last night. The UPS goes into sleep mode (LEDs cycling) once the shutdown delay has done its thing. I can even see the UPS logs reporting that the unRAID server has issued the PowerChute shutdown command - I don't recall ever seeing that before. Checking the IPMI interface during the shutdown process doesn't throw any apcupsd errors anymore (the ones you see in the screenshot of that thread). Before doing your fix, the UPS would just run its batteries right down to critical, causing unnecessary wear on them when I wanted it to shutdown around the 80% remaining mark. Thank you for this. Quote Link to comment
hotio Posted June 1, 2020 Author Share Posted June 1, 2020 Glad to see it helped somebody...it also took me a while before I found the solution....never thought limetech wouldn't have thought about this usecase, although on ubuntu I also had to override the default systemd service. You'd expect an UI toggle to include all use cases and not just usb.... Quote Link to comment
Goldfire Posted June 2, 2020 Share Posted June 2, 2020 Annoyingly, it actually did work at some point in an older build of unRAID - something must have been changed regarding apcupsd. I wouldn't be able to tell you which one build, but I do recall seeing my UPS going into sleep correctly once back in late 2018. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.