[ltp] Detecting a kernel message

Thomas Vogels linux-thinkpad@www.bm-soft.com
14 Sep 2001 22:56:59 -0400


"Dr. Aldo Medina" <aldo_medina@yahoo.com> writes:

> I'm own a thinkpad 380ED with a 3com LAN/Modem PCMCIA card. I use this
> laptop in my work (connecting to the LAN), and working at home (Modem).
> I know about divine and other programs who configure my networking
> options at boot time, but I was looking for some way to make the changes
> "in the fly". That is: working at work, hibernating, then going home and
> just turn on my computer. I already defined two schemes for this needs
> (cardctl scheme modem and cardctl scheme net).

curiosity killed the cat...  Does the laptop know when it returns from
hibernation?  (When I send my laptop to sleep via 'apm -s', then I can
wake it up and scripts in /etc/apm/event.d will be run at that time.
Is there something comparable happening when you hibernate/power on?)

How is your LAN connection controlled?  If you have something like
DHCP, check out how the client is run---if it cannot get an IP address
(a lease...)  then maybe that would be a good time to run 'cardctl
scheme modem'?  Otherwise (after powerup) assume scheme net?

Why don't you wrap the two 'cardctl scheme' calls around your dial-in?

I guess you leave your pcmcia card always in the laptop?  My simple,
hardware-based solution with having to deal with two networks, is to
put the network card in the upper slot on campus and in the lower slot
at home.  Trivial to handle in network.opts...

> However, I was thinking if its possible to monitor kern.info messages,
> looking for the "lost link beat" and "found link beat" messages, so some
> script could run in the background and change schemes for me.

hmm, is this what you had in mind?

case `grep 'kernel: eth.*link beat' /var/log/messages | tail -1` in
*found*) echo "at work"; cardctl scheme net;;
*lost*) echo "at home"; cardctl scheme modem;;
esac

(This fails miserably if the hostname contains found or lost...)

  -tom


>=20
> Is this possible?
> Is this safe (removing and inserting the RJ45 cable without turning off
> the card, but when there isn't any traffic)?
>=20
> TIA
>=20
> --=20
> Linux User #98419         -o)    | Va un hombre al hospital y le dice=20
> http://counter.li.org      /\    | al m=E9dico: Doctor me duele aqu=ED. Y=
=20
> ICQ 94335020              _\_v   | le contesta el m=E9dico: Pues p=F3ngase
>                                  | all=E1
>=20
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>=20
>=20
> ----- The Linux ThinkPad mailing list -----
> The linux-thinkpad mailing list home page is at:
> http://www.bm-soft.com/~bm/tp_mailing.html


----- The Linux ThinkPad mailing list -----
The linux-thinkpad mailing list home page is at:
http://www.bm-soft.com/~bm/tp_mailing.html