[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: laptop, anacron and lan :

> > > I have a very naive question:
> > > is there a very simple way to run job periodically
> > > BUT only when the LAN connection is enabled ?

> But, as in my case,
> it is usless if you let permanently you card in its plug:
> with realport card pluging means pluging the cable to the card.

> Any more idea ?

For most people, being at a LAN connection also means being
near a power source; if this is true for you, you can do
what I do: hook into apmd's event stuff.

On my debian potato/woody OB800, I put a script in 
/etc/apm/event.d that that triggers on the transition to AC 
(I'm not sure where this is documented; I discovered it by 
reading /etc/apm/apm_proxy). (I guess you'd want to get in
the habit of pluggin in the LAN connection before the AC,
huh?).  I use this technique to /etc/init.d/*/stop daemons 
that are pointless without a LAN connenction or power and
start them back up when I connect.  I even unload pcmcia 
since I don't have any battery-powered pcmcia devices.  This 
seriously increases battery life since it doesn't swap as much.

Older versions of support triggering on suspend and resume 
only (/etc/apm/suspend.d and /etc/apm/resume.d) so you'd
have to have a resume script check for battery vs AC via
the contents of /proc/apm or output of /usr/bin/apm (the
latter is much more readable).  

Hope this works for you too.

Reply to: