Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 592108 - sys-power/apcupsd-3.14.13: after power failure, send email when starting
Summary: sys-power/apcupsd-3.14.13: after power failure, send email when starting
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: John Einar Reitan
Keywords: PATCH
Depends on:
Reported: 2016-08-25 16:05 UTC by denis.chancogne
Modified: 2020-09-07 18:02 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

Patch to /etc/init.d/apcupsd (apcupsd.init.4.patch,1.77 KB, patch)
2016-08-25 16:05 UTC, denis.chancogne
Details | Diff
New file (patched) /etc/init.d/apcupsd (apcupsd,889 bytes, text/plain)
2016-08-25 16:06 UTC, denis.chancogne

Note You need to log in before you can comment on or make changes to this bug.
Description denis.chancogne 2016-08-25 16:05:07 UTC
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)

Best regards,
Denis Chancogne

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.
Comment 1 denis.chancogne 2016-08-25 16:06:14 UTC
Created attachment 444104 [details]
New file (patched) /etc/init.d/apcupsd