From: "Sebastian Piecha" <spi@gmxpro.de>
To: Jim Keniston <jkenisto@us.ibm.com>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: How to wait for kernel messages?
Date: Wed, 15 Oct 2003 00:57:28 +0200 [thread overview]
Message-ID: <3F8C9B78.6957.17859BC3@localhost> (raw)
In-Reply-To: <3F8C6576.464328CE@us.ibm.com>
[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 641 bytes --]
> On Mon, 13 Oct 2003, Sebastian Piecha wrote:
>
> > I have some problems with one NIC. Due to lack of time as an
> > workaround I'd like to wait for the kernel message "NETDEV WATCHDOG:
> > eth0: transmit timed out" and ifconfig down/up the NIC.
> >
> > How can I trigger any action by such a kernel message? Do I have to
> > grep the kernel log?
> >
Thanks a lot for all the hints. I'm using now a fifo to which syslogd
is logging kernel messages. A shell script greps the right message.
I attach the shell script inline for whom it may be interesting.
Mit freundlichen Gruessen/Best regards,
Sebastian Piecha
EMail: spi@gmxpro.de
[-- Attachment #2: Attachment information. --]
[-- Type: text/plain, Size: 466 bytes --]
The following section of this message contains a file attachment
prepared for transmission using the Internet MIME message format.
If you are using Pegasus Mail, or any other MIME-compliant system,
you should be able to save it or view it from within your mailer.
If you cannot, please ask your system administrator for assistance.
---- File information -----------
File: check_nic.txt
Date: 15 Oct 2003, 0:56
Size: 771 bytes.
Type: Text
[-- Attachment #3: check_nic.txt --]
[-- Type: Application/Octet-stream, Size: 735 bytes --]
#!/bin/bash
# Signalling
trap 'exit 0' SIGTERM
trap '' SIGHUP
# grep
arg1="NETDEV WATCHDOG: eth0: transmit timed out"
#arg2="dhcpd: receive_packet failed on eth0: Network is down"
# Syslog
tag=$0
prio="kern.err"
fifo=/var/log/check_nic
IFCONFIG=$(which ifconfig)
SLEEP=$(which sleep)
EGREP=$(which egrep)
DATE=$(which date)
HOSTNAME=$(which hostname)
LOGGER=$(which logger)
while true
do
read line < $fifo
echo $line | \
$EGREP -e "$arg1" \
> /dev/null 2>&1
if [ $? -eq 0 ] ; then
$IFCONFIG eth0 down
$SLEEP 1
$IFCONFIG eth0 up
$LOGGER -t $tag -p $prio "eth0 down, restarting..."
$SLEEP 5
fi
done
next prev parent reply other threads:[~2003-10-14 22:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-14 21:07 How to wait for kernel messages? Jim Keniston
2003-10-14 22:57 ` Sebastian Piecha [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-10-13 13:59 Sebastian Piecha
2003-10-14 12:12 ` Richard B. Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F8C9B78.6957.17859BC3@localhost \
--to=spi@gmxpro.de \
--cc=jkenisto@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox