Gentoo Archives: gentoo-laptop

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