[ltp] Detecting a kernel message

Tod Harter linux-thinkpad@www.bm-soft.com
Sun, 16 Sep 2001 16:08:22 -0400


Ah, I see. I suspect this is a task beyond the capacity of a shell script, 
though someone is likely to prove me wrong, it is amazing what you can do 
with them sometimes! 

I'm sure someone on this list can make a perl script, but it seems to me that 
your need is fairly specific and you would probably have to tweak it to get 
exactly the results you want anyway. I would suggest getting hold of a copy 
of Programming Perl (the "Camel Book"), and also highly recommend its 
companion, the Perl Cookbook, which I think has about 90% of the code you 
need already provided in various examples (in general this book is a HUGE 
bonus to anyone writing perl utility scripts).


On Friday 14 September 2001 16:59, you wrote:
> Thanks for your help. I already made some scripts which do the route and
> ifconfig stuff for me, and patched /etc/network.options with them. All I
> have to do is a cardctl scheme command to change my network
> configuration. However my problem is in programming. I simply don't know
> perl, and I haven't been able to use bash to parse /var/log/messages.
>
> Tod Harter wrote:
> > I've never heard of a network card being damaged by connecting or
> > disconnecting the cable while the machine was powered. I would say from
> > experience that its fine. Voltages on ethernet are very low and use very
> > little current.
> >
> > I must say that your problems echo my own. I've found that with my A20p
> > that the built in NIC becomes confused when I unhook from the network and
> > then suspend. Afterwards I have to reboot to get back on the LAN. Someone
> > said this has to do with APM scripts.
> >
> > All I do is when I want to use the modem is I manually issue "ifconfig
> > eth0 down" and then dial in. Generally I find that the ppp setup system
> > forgets to provide a default route though, which means you have to issue
> > "route add default gw <ip-addr-of-ppp0>" by hand. Even though I created a
> > couple of configs using Mandrake's Drakconf tool it still doesn't happen
> > on its own. Personally I've yet to see any of these tools do it properly.
> > The ppp subsystem never really properly cleans up the resolve.conf file
> > either, it just grows full of "temporary settings" for name service,
> > which you have to clean out every so often...
> >
> > My general opinion of all these configuration tools is that none of them
> > really works all that well. There are way too many different ones and
> > they all seem half broken. Linuxconf does some things ok but other things
> > it is totally broken for, and the same goes for chkconfig, ntsysv,
> > webmin, etc. Frankly my answer is to figure out what commands need to be
> > issued for various situations, write a script that does it, make it suid
> > root, and just run it from a shell at the appropriate time.
> >
> > As for monitoring the link beat, I guess you could write a little perl
> > script that piped a "tail -f /var/log/messages" and scanned it for what
> > you are interested in you could dynamically reconfigure. It just wasn't
> > worth the trouble to me.
> >
> > I know this is a bit wordy, and partly a tangent to your question, but if
> > there is one MAJOR place in which linux falls down flat it is just this
> > sort of thing. Windows may be annoying as heck, but generally speaking it
> > does a much better job of making routine changes like this easy to do. I
> > feel that if Linux is to succeed as an end-user platform a LOT more
> > attention needs to be paid to this kind of issue. The tools that are out
> > there seem partial, badly documented, often broken, and to be quite frank
> > more trouble than they are worth. Linux badly needs a single common
> > configuration system that all distributions can adhere to. Until that
> > happens only serious bitheads are going to be able to use it, and there
> > are many times when I resent the amount of effort required to accomplish
> > simple tasks like driver installs and just plain routine configuration
> > tasks. The situation is a really nasty mess!
> >
> > On Friday 14 September 2001 14:25, you wrote:
> > > 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).
> > >
> > > 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.
> > >
> > > Is this possible?
> > > Is this safe (removing and inserting the RJ45 cable without turning off
> > > the card, but when there isn't any traffic)?
> > >
> > > TIA

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