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

recursive finds, kernels, and laptops

Something no Linux distribution has really focused on yet is how to run
well on laptops.  When I installed slink on my laptop a month ago, I did 
notice that there was a "laptop" install option, but it really only had
to do with which packages were pre-selected; and none of these really
had a whole lot to do with the main difference between a laptop and a
console computer: the battery.

Since the install, I've been applying hand patches to various cron jobs
and init scripts, and recompiling kernels every time a new pcmcia-cs is
released.  Just recently, the tetex package appears to have installed an
init.d script to "ls -R" daily, and it occurred to me that instead of we 
laptop owners constantly hunting down and modifying installed scripts,
perhaps steps could be taken in Debian to address these issues.

First, and easiest, it'd be nice to have a precompiled kernel with APM
support.  I'd be willing to maintain this if Herbert Xu doesn't want to.

Doing recursive finds is a real killer for a device that runs on a
battery, since exercising the hard drive for such a long period of time
can significantly decrease the life expectancy of the battery.
Currently, my solution is the following text in an entry in
/etc/cron.daily such as "man-db" or "find":

  if [ `awk '{ print $4 }' </proc/apm` = "0x00" ]; then
    exit 0

I propose starting a new chain of laptop-specific packages, which, along 
with appropriate alternatives in the normal packages, will provide some
battery-checking functionality before any non-essential disk-intensive
operations begin.  The normal operation would still exist, but a
battery-version should also be provided which does some checking on the
battery status (if available).  Non-essential cron jobs, etc., could use 
this version.

Right now I'm thinking mainly of "find", but an "ls-r" alternative might 
be nice as well.  But to use "find" as an example:

/usr/bin/find             Normal find utility
/usr/bin/find-apm         A laptop-version wrapper

find-apm would look something like this:

if [ -f /proc/apm ]; then
  batt=`cat /proc/apm | (read a b c d e; echo $e)`
  if [ $batt != "0x00 ]; then
    exec /usr/bin/find "$*"

Then we would want to convince the maintainers of various pacakges, such 
as "findutils", to update their various things to use find-apm instead
of find.


Neale Pickett, propellerhead       Contact information in headers
Los Alamos National Laboratory, Network Engineering Group (CIC-5)

Reply to: