onBatteryPower

Richard Hughes hughsient at gmail.com
Wed Oct 26 11:18:34 PDT 2005


On Wed, 2005-10-26 at 14:08 -0400, David Zeuthen wrote:
> On Wed, 2005-10-26 at 17:55 +0100, Richard Hughes wrote:
> > So we could add something like this:
> > 
> > acad=`hal-find-by-capability --capability ac_adapter`
> > if [ $acad ] ; then
> > 	onac=`hal-get-property --udi=$acad --key=ac_adapter.present`
> > 	if [ "x$onac" == "xfalse" ] ; then
> > 		echo "On battery power, aborting"
> > 		exit 1
> > 		fi
> > 	fi
> > 
> > at the top of a typical cron script, say for instance:
> > 
> > * makewhatis
> > * prelink
> > * rpm
> > * slocate
> > * yum
> 
> I think the Fedora scripts use the Fedora specific /usr/bin/on_ac_power
> tool (which asks HAL) to do exactly this. 

Ahh yes. I knew not of this program.

> Can I ask why you are worried about all this?

Well, makewhatis kicked in when I was on battery power, and my CPU went
up to 100%. I'm just wondering how easy it was to integrate the cron
jobs with the hal power stuff, but it sounds like you have it covered in
rawhide.

Ignore me. :-)

Richard.



More information about the hal mailing list