Laptops :: init.d/powerfail ?



G'Day, in the inittab file there are a couple of entries relating to power events, like "powerfailnow", which I believe should trigger something to happen if the laptop detects low battery and is about to shutdown.

However the script it is calling is "/etc/init.d/powerfail" which does not seem to exist, at least on my HD install.  Anyone know where the file is, or what it typically contains.

It would be handy if it could popup some sort of message to remind me, because I always start using the laptop and forget to plug it in, and then it just dies suddenly without warning.

You could create your own, with something like:

#!/bin/ash
clear
sync
echo Losing power! Shutting down...
shutdown -h -t1

That's only effective in console.. Wonder how to popup in X? I think there is a program called xmessage, which can be used with something like
xmessage "Battery nearly dead!"

Thanks curaga, xmessage works a treat!

The inittab/powerfail stuff doesn't seem to work.  On a little more reading it seems it only relates to UPS type situations.

I installed 'acpid' and got it to work quite easily though.

I believe you could write a script for acpid to create a warning when there was, say, only 10% battery remaining and execute "exitcheck.sh shutdown" when only 5% remains.

Maybe there is also a way to have torsmo create a warning when there is, say, 10 minutes battery remaining.


original here.