Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Power management - slocate
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
TheNewb
Apprentice
Apprentice


Joined: 10 Jun 2005
Posts: 183

PostPosted: Mon Mar 05, 2007 5:16 pm    Post subject: [solved] Power management - slocate Reply with quote

I'm having a problem, every time I boot the laptop it ALWAYS without fail starts the updatedb application, which cuts a lot of battery life.

What I want to do is add a condition to the beginning of /etc/cron.daily/slocate to check if the laptop is currently on battery or not.


So far I haven't been able to figure out how to query this value, any hints?
_________________
#define struct union /* A Real space saver! :) */


Last edited by TheNewb on Mon Mar 05, 2007 7:40 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9890
Location: almost Mile High in the USA

PostPosted: Mon Mar 05, 2007 7:05 pm    Post subject: Reply with quote

this might work, if your ACPI system is compiled and working properly?

Code:
if grep -q on-line /proc/acpi/ac_adapter/AC/state; then updatedb; fi


Been a while since I used APM if you're stuck with that, would take a while to jog my memory...

(ugh. I wish ACPI code was smaller. it's HUGE! luckily my laptop has 1GB RAM...)
Back to top
View user's profile Send private message
TheNewb
Apprentice
Apprentice


Joined: 10 Jun 2005
Posts: 183

PostPosted: Mon Mar 05, 2007 7:39 pm    Post subject: Reply with quote

That is great! Was just what I was looking for..

For anyone interested in the new cron file,
Code:

#! /bin/sh
if grep -q on-line /proc/acpi/ac_adapter/ACAD/state
then
  if [ -x /usr/bin/updatedb ]
  then
        if [ -f /etc/updatedb.conf ]
        then
                nice /usr/bin/updatedb
        else
                nice /usr/bin/updatedb -f proc
        fi
  fi
fi


Thanks!
_________________
#define struct union /* A Real space saver! :) */
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum