From: Greg KH <greg@kroah.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: Monitoring attributes of the device
Date: Thu, 21 Jan 2010 06:26:55 +0000 [thread overview]
Message-ID: <20100121062655.GA2295@kroah.com> (raw)
In-Reply-To: <AF896E422AB31E4A997273D1565F212803987CD63A@mtw02msg03.mindtree.com>
On Thu, Jan 21, 2010 at 10:57:26AM +0530, Shashank KotaSathish wrote:
> Hi,
>
> I wanted to know is it possible to write a rule for the udev which will run a program when the attribute of the device changes. For example if the ethernet plug is removed, the attribute "carriers" of net class will change from 1 to 0. To track this change i wrote the following rule in the /etc/udev/rules.d/70-persistent-net.rules file
>
> SUBSYSTEM="net", DRIVERS="?*", ATTR{carrier}="0", ATTR{address}="00:0c:29:27:a2:95", ATTR{dev_id}="0x0", ATTR{type}="1", KERNEL="eth*", RUN+="/bin/up.sh"
>
> up.sh will echo some thing in to the text file in my home directory.
> But the up.sh is not getting executed. Thanks in advance.
No sysfs event is getting emitted by the kernel when this attribute
changes. You need to modify the kernel to create such an event, and
then your script can run.
Or you can just use ethtool and detect the carrier change that way, like
the rest of the world does :)
Hope this helps,
greg k-h
next prev parent reply other threads:[~2010-01-21 6:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-21 5:39 Monitoring attributes of the device Shashank KotaSathish
2010-01-21 6:26 ` Greg KH [this message]
2010-01-22 4:12 ` Shashank KotaSathish
2010-01-26 6:07 ` Stephen Hemminger
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=20100121062655.GA2295@kroah.com \
--to=greg@kroah.com \
--cc=linux-hotplug@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;
as well as URLs for NNTP newsgroup(s).