[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: setup apm for 'battery low' warning on textconsole



On Tue, 2003-02-11 at 18:36, mi wrote:
> Hello,
> while i was roaming on a textconsole,  and the laptop only on battery, the 
> machine suddenly powered off.   Leaving it badly with filesystem checks.
> Now i wonder how to get a 'battery critical' warning yonder there .... ?

Write a cronjob that logs the battery level, and which logs with
"Emergency" level

#!/bin/sh
if [ "`apm | cut -f5 -d\ | cut -f1 -d% `" -lt "8" ]; then
  logger -p user.emerg "Battery is critical! - `apm`"
fi

Then set up a cronjob to run that every few minutes.  On a console
screen I think the "emergency" log level should come up in the middle of
whatever you're doing.


Something along those lines should work anyway.

Cheers,
					Andrew.
> 
> -- 
> 
> micha.
-- 
---------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St,  Wellington
WEB: http://catalyst.net.nz/         PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201     MOB: +64(21)635-694    OFFICE: +64(4)499-2267
           Survey for nothing with http://survey.net.nz/ 
---------------------------------------------------------------------



Reply to: