airplane battery saving mode
James Gray
james at grayonline.id.au
Sun Jan 15 21:21:06 UTC 2006
On Mon, 16 Jan 2006 06:13, Albert wrote:
> Hi all,
>
> I'm planning an overseas trip which will last over 11 hours, and I will
> need the computer to write and read code while on flight. Since 2
> batteries will span to a max of 8 hours total doing such low-energy
> consumption tasks, I wonder how can I make kubuntu behave along, and make
> the batteries really last for 8 hours total. (I'm already taking an hout
> our of each battery, because manufacturer's battery benchmarks are
> bullshit).
>
> What I need is a run mode that has ZERO services (no convinience daemons
> whatsoever, no media, no automatic nothing) and also ZERO cron jobs. I
> don't want the updatedb to run for several minutes with a 'nice' of 10.
My lappy (Kubuntu) doesn't run any of the anacron jobs if I'm on battery
power. I have a few customised cron jobs (like checking VPN connections)
that run at regular intervals but they simply look for files in /proc etc.
My point is, that unless you've changed something, Ubuntu doesn't run
anacron jobs whilst on battery. Anacron is all the stuff
in /etc/cron.daily etc.
> So I would appreciate if someone could point to docs on how to create
> such a boot mode, and/or straighforward examples. I am aware of some
> discussions here comparing debian and ubuntu, which implied one can
> create such run modes at will.
You have two options:
1. Edit a runlevel so you have customised services (runlevel 4 is a good
candidate). Then edit /etc/inittab to automatically boot into that
runlevel (or once booted, "sudo init 4")
2. Use "profile" system at boot that the init scripts parse and modify their
launch behaviour. There are a few out there (like "whereami") or you can
roll your own.
I've implemented #2 with a home-grown solution. When the grub boot screen
comes up I can select a number of profiles (Home/Office/Offline/Roaming).
All this does is add a "Profile=FOO" to the boot command line
(cat /proc/cmdline).
Then I have a script that runs very early in the /etc/rcS.d stage which
reads /etc/cmdline and rips out the profile setting, then sets up all the
config files for services that need modifying in that profile. This is
done by creating separate configs files for each profile then symbolically
linking them to the normal config file name. eg,
Profile=Home
/etc/network/interfaces -> /etc/network/interfaces.Home
So now when the network is configured and wants to
source /etc/network/interfaces it's actually reading the configuration for
home :)
Now that all the configs have been set up, the rest of the boot process
proceeds normally with some things starting and others exiting gracefully
(because they are disabled in /etc/default). For instance, if I am
"Offline" the ntp time sync is disabled, none of the network interfaces
come up automatically, Postfix doesn't start and other network services
stay down too. I've also written some funky sed scripts that edit the
kmail configuration file, so that when I'm Offline or Roaming, it doesn't
have interval mail checking and doesn't try to send messages immediately.
Then the kmail config is put back to normal in Home/Office profiles.
If anyone is interested in my profile scripts then contact me off list :) I
didn't have any real success with "whereami" so I rolled-my-own in much the
same was SuSE does their profiles.
HTH,
James
--
micro:
Thinker toys.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kubuntu-users/attachments/20060116/3adf190b/attachment.sig>
More information about the kubuntu-users
mailing list