onBatteryPower

David Zeuthen david at fubar.dk
Wed Oct 26 11:08:36 PDT 2005


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. 

Can I ask why you are worried about all this?

Cheers,
David




More information about the hal mailing list