You are not logged in.

#1 2013-05-31 19:26:05

kornfan71
Member
Registered: 2013-05-09
Posts: 2

[SOLVED] Kill power to APC UPS during power failure?

Hello all,
I recently migrated my home server to Arch from Ubuntu Server. I have an APC UPS connected to it, and I use apcupsd to handle it.
In Ubuntu, in the event of a power failure, the computer would eventually be turned off, and apcupsd would issue the "killpower" command to the UPS, to save battery.

So far in Arch, the computer is shut down properly, but I cannot for the life of me get it to kill power to the UPS properly.
I can manually create the "powerfail" flag and then run "apcupsd -k". That works as expected.

As far as I can tell, this may have to do with systemd, since apcupsd appears to change /etc/init.d/halt to check for the powerfail flag.

So far, I have created a script that checks for the powerfail flag, and will kill UPS power if it is present.
I set it up as a systemd service as such:

[Unit]
Description=Tell apcupsd to send killpower to UPS during shutdown in a powerloss situation
Before=shutdown.target

[Service]
Type=oneshot
ExecStart=/etc/apcupsd/killpower_workaround
RemainAfterExit=yes

[Install]
WantedBy=shutdown.target

This doesn't seem to work, though. The UPS will remain on indefinitely after apcupsd has shut off the computer.

I'm running on the assumption that the script is running correctly, but I'm not entirely sure, and I'm unsure how to check. My only guess at this point is that the powerfail flag is being created after my script runs, or some kind of similar problem...but I don't really know how to check that, either.

Has anyone gotten apcupsd to properly shut down the computer and kill power to the UPS during a power failure?

Thanks in advance!

Last edited by kornfan71 (2013-06-01 04:59:34)

Offline

#2 2013-06-01 04:57:52

kornfan71
Member
Registered: 2013-05-09
Posts: 2

Re: [SOLVED] Kill power to APC UPS during power failure?

After some more digging, I found a workaround that seems to do what I need.
Instead of making it a oneshot service, I made it a normal one, as suggested on a similar question on StackExchange.

I guess I asked a little too soon! tongue

Offline

Board footer

Powered by FluxBB