1 |
Thanks for the tip on laptop-mode-tools, I hadn't see that. |
2 |
|
3 |
You may also want to check out sys-power/powermgmt-base. It adds |
4 |
/usr/bin/on_ac_power which simply exits with 0 if laptop's on AC and with 1 |
5 |
if it's on battery. |
6 |
|
7 |
This lets you make easy changes to the scripts in /etc/cron.* such as |
8 |
wrapping the body of /etc/cron.daily/slocate in |
9 |
|
10 |
if /usr/bin/on_c_power ; then |
11 |
... |
12 |
fi |
13 |
|
14 |
dcm |
15 |
|
16 |
On 9/27/06, Fred Labrosse <ffl@×××××××.uk> wrote: |
17 |
> |
18 |
> All, |
19 |
> |
20 |
> I recently discovered laptop-mode-tools and it does replace advantageously |
21 |
> the |
22 |
> scripts I had written to respond to acpi events. And it does much more! |
23 |
> |
24 |
> One thing it does not do (nor were my scripts) is turn off things like |
25 |
> updatedb when running on battery. I looked into that and thought about |
26 |
> the |
27 |
> various options and here's the result: |
28 |
> |
29 |
> - One could just move the slocate script from and in /etc/cron.daily to |
30 |
> control it running or not. The problem with that approach is that the |
31 |
> script |
32 |
> needs to be saved somewhere and then moved (or linked) when it is needed. |
33 |
> Moreover, if people want to run it weekly instead of daily, then the |
34 |
> moving |
35 |
> needs to be changed. |
36 |
> |
37 |
> - One could remove the slocate script from /etc/cron.daily (or wherever it |
38 |
> is) |
39 |
> and have a line in the crontab file. This has very similar limitations to |
40 |
> the method above. |
41 |
> |
42 |
> - One could have laptop-mode-tools write something like |
43 |
> "updatedb=[off|on]" in |
44 |
> some state file (let's say in /var/state) and have the slocate |
45 |
> script source |
46 |
> that state file and run or not updatedb based on the value of the defined |
47 |
> variable. This would not have the above limitations and could be applied |
48 |
> to |
49 |
> all the cron jobs. However, this would need modifying system scripts, |
50 |
> therefore introducing more work at every update of these. |
51 |
> |
52 |
> I do think that the final method is the way to go to solve that problem |
53 |
> and |
54 |
> would be interested in developing/experimenting that. |
55 |
> |
56 |
> Has anybody done anything like that? Is that something that could be |
57 |
> integrated in gentoo at some stage? Do people have |
58 |
> suggestions/comments/criticisms, etc.? |
59 |
> |
60 |
> Cheers, |
61 |
> |
62 |
> Fred |
63 |
> -- |
64 |
> gentoo-laptop@g.o mailing list |
65 |
> |
66 |
> |