init.d/powerfail ?Forum: Laptops Topic: init.d/powerfail ? started by: Wittfella Posted by Wittfella on Mar. 16 2007,10:37
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. Posted by curaga on Mar. 16 2007,17:11
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!" Posted by Wittfella on Mar. 17 2007,08:39
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. Posted by Juanito on Mar. 17 2007,08:59
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. |