Created attachment 444102 [details, diff]
Patch to /etc/init.d/apcupsd
I use apcupsd to manage my APC BR900GI. I saw a problem on util power loss
so I send you this patch.
The problem is :
- on util power loss, apcupsd (by apccontrol) send a email, then when
util power return, it send another email
- but when there is a long power fail and the computer is stopped, there
is a mail to say that power is lost, but when the power comes back and
so computer start again there is no email to say that power returned.
So I have added a fonction to call "apccontrol offbattery" if the powerfail
file is present on startup. My patch is joined, and so the new init.d apcupsd
In the same time, I used last features of openrc to manage daemon start-stop
I did the following tests :
- /etc/init.d/apcupsd stop => OK
- /etc/init.d/apcupsd start => OK
- /etc/init.d/apcupsd restart => OK
- touch /etc/apcupsd/powerfail; /etc/init.d/apcupsd restart => OK
(email is well sent)
NB: before to call "apccontrol", I have added "sleep 2" because without this,
output of "apcaccess" command wasn't full, I think apcupsd needs time (some
seconds) to start fully.
Created attachment 444104 [details]
New file (patched) /etc/init.d/apcupsd