You are not logged in.
hiberbat - A simple daemon to hibernate on low battery
This daemon runs once in a specifiable while to check if the main battery is on a critical level.
If so, it uses hibernate-script to hibernate the machine.
The beauty of the things is that it uses no resources most of the time and it is highly configurable (see the project page).
AUR page: http://aur.archlinux.org/packages.php?ID=47291
Project page: http://timvdalen.nl/projects/hiberbat/
Offline
Updated the PKGBUILD to include 'hibernate-script' as a dependency.
Warning: makepkg will not be able to auto install hibernate-script.
Offline
-
Last edited by x5x_tim (2011-03-14 11:21:17)
Offline
Updated to version 1.0.1: log files now include actual battery level
Offline
What would be the advantage of using this over sleepd?
ᶘ ᵒᴥᵒᶅ
Offline
Hiberbat uses no resources at all most of the time. You can specify the number of seconds between the checks for multiple steps (for b is the current battery level, currently b>50, 20<=b<=50 , b <20). I am planning on letting users specify these steps in the config in the future.
That will probably be like steps = (100, 50, 20, 2), time = (240, 120, 30).
So basically, I wrote hiberbat with resources and configurability in mind.
And hey, doesn't 'hiberbat' sound way cooler than 'sleepd'?
Offline
Couldn't one do the checking with a cron job?
Offline
Couldn't one do the checking with a cron job?
I thought about that solution but I decided against it.
I use sleep between checks (not some infinite while loop that keeps looping until something is true) which means that the process is just put to sleep by the OS and uses no resources until it is waken.
Now, in my opinion, using a cron job would only make this harder. The program would have to insert the time for the next wake into the contab file for each time it is ran.
What were your arguments for preferring a cron job?
Offline
Yeah, I guess your script is more flexible than a simple cron job, since you do checking more frequently.
Nevermind then. :-)
Offline
Yeah, I guess your script is more flexible than a simple cron job, since you do checking more frequently.
Nevermind then. :-)
The main problem is that the time between checks is a function of the current battery life.
Offline
I think I may have discovered a bug in your program. I installed Hiberbat, started the daemon, added an entry to my /etc/rc.conf and continued browseing the internet for an hour or so until my battery died. No popup, no hibernatrion, just shutdown without warning. The interesting part of all this came when I tried to turn my laptop back on again (after pluging in the charger), it would go through the normal boot process but shut off when the command prompt loaded. This happened three times, the only way I could turn on my laptop again was to remove the battery.
Offline
I think I may have discovered a bug in your program. I installed Hiberbat, started the daemon, added an entry to my /etc/rc.conf and continued browseing the internet for an hour or so until my battery died. No popup, no hibernatrion, just shutdown without warning. The interesting part of all this came when I tried to turn my laptop back on again (after pluging in the charger), it would go through the normal boot process but shut off when the command prompt loaded. This happened three times, the only way I could turn on my laptop again was to remove the battery.
This is really interesting behaviour. I think what happened is that your battery drained from 2% to empty to fast for the program to notice. I'd suggest dailing the last interval in /etc/hiberbat.conf down to 15.
Could you also turn on logging?
Please post the results of these commands:
$acpi
$hibernate -v
I can't think of a way hiberbat caused the second problem though. Are you sure hibernation works correctly on your laptop?
Offline
ShawnB391 wrote:I think I may have discovered a bug in your program. I installed Hiberbat, started the daemon, added an entry to my /etc/rc.conf and continued browseing the internet for an hour or so until my battery died. No popup, no hibernatrion, just shutdown without warning. The interesting part of all this came when I tried to turn my laptop back on again (after pluging in the charger), it would go through the normal boot process but shut off when the command prompt loaded. This happened three times, the only way I could turn on my laptop again was to remove the battery.
This is really interesting behaviour. I think what happened is that your battery drained from 2% to empty to fast for the program to notice. I'd suggest dailing the last interval in /etc/hiberbat.conf down to 15.
Could you also turn on logging?Please post the results of these commands:
$acpi $hibernate -v
I can't think of a way hiberbat caused the second problem though. Are you sure hibernation works correctly on your laptop?
[shawn@laptop ~]$ acpi
Battery 0: Discharging, 93%, rate information unavailable
[shawn@laptop ~]$ sudo hibernate -v
Password:
hibernate: option requires an argument -- 'v'
Which verbosity level would you like me to use?
I ran into the same problem today. When my battery is dead, and plugged in, it seems hiberbat wants to shut it down right away. The only soultion is to remove my battery. Maybe you could add a check to see if the battery is chargeing? My swap partition was way too small for hibernation to work properly, but everything is working now. I'm going to let my battery drain again so I can see if hiberbat will send it into hibernation, I'll report back soon.
Offline
I actually assumed that in the time that the laptop would boot, the battery level would be back at 2%. I could add a check for charging... What if you plug it in for a few minutes and then boot it?
Offline