public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* some question about "/sys/class/net/<iface>/operstate"
@ 2020-11-11  4:31 杜英杰
  2020-11-11 19:02 ` Cong Wang
  0 siblings, 1 reply; 5+ messages in thread
From: 杜英杰 @ 2020-11-11  4:31 UTC (permalink / raw)
  To: netdev

I want to use inotify to monitor /sys/class/net//operstate  to detect status of a iface in real time. 
when I ifdown &amp;&amp; ifup eth3, the content of operstate changed, but the file's Modify time didn't change. 
I don't know the reason, is there any file which can be monitored by inotify to get iface status in real time? 
Much appreciation for any advice! 


below are my terminal msg:
  
[root@yingjie-4-5-0-20201109195739-1 11:10:39 0000:00:0c.0]$stat /sys/class/net/eth3/operstate 
File: ‘/sys/class/net/eth3/operstate’
Size: 4096            Blocks: 0          IO Block: 4096   regular file
Device: 14h/20d Inode: 25838       Links: 1
Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-11-10 20:42:18.592000969 +0800
Modify: 2020-11-10 20:42:18.592000969 +0800
Change: 2020-11-10 20:42:18.592000969 +0800
Birth: -
[root@yingjie-4-5-0-20201109195739-1 11:10:50 0000:00:0c.0]$cat /sys/class/net/eth3/operstate 
up
You have new mail in /var/spool/mail/root
[root@yingjie-4-5-0-20201109195739-1 11:11:06 0000:00:0c.0]$ifdown eth3
[root@yingjie-4-5-0-20201109195739-1 11:11:13 0000:00:0c.0]$cat /sys/class/net/eth3/operstate 
down
[root@yingjie-4-5-0-20201109195739-1 11:11:16 0000:00:0c.0]$stat /sys/class/net/eth3/operstate 
File: ‘/sys/class/net/eth3/operstate’
Size: 4096            Blocks: 0          IO Block: 4096   regular file
Device: 14h/20d Inode: 25838       Links: 1
Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-11-10 20:42:18.592000969 +0800
Modify: 2020-11-10 20:42:18.592000969 +0800
Change: 2020-11-10 20:42:18.592000969 +0800
Birth: -



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-11 21:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-11  4:31 some question about "/sys/class/net/<iface>/operstate" 杜英杰
2020-11-11 19:02 ` Cong Wang
2020-11-11 19:55   ` Stephen Hemminger
2020-11-11 20:34     ` Erik Kline
2020-11-11 21:17       ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox