View previous topic :: View next topic |
Author |
Message |
TheNewb Apprentice
Joined: 10 Jun 2005 Posts: 183
|
Posted: Mon Mar 05, 2007 5:16 pm Post subject: [solved] Power management - slocate |
|
|
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 |
|
|
eccerr0r Watchman
Joined: 01 Jul 2004 Posts: 9890 Location: almost Mile High in the USA
|
Posted: Mon Mar 05, 2007 7:05 pm Post subject: |
|
|
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 |
|
|
TheNewb Apprentice
Joined: 10 Jun 2005 Posts: 183
|
Posted: Mon Mar 05, 2007 7:39 pm Post subject: |
|
|
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 |
|
|
|