[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 11 Nov 2020 12:31:27 +0800 (GMT+08:00)
From: 杜英杰 <leondyj@....edu.cn>
To: netdev@...r.kernel.org
Subject: some question about "/sys/class/net/<iface>/operstate"
I want to use inotify to monitor /sys/class/net//operstate to detect status of a iface in real time.
when I ifdown && 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@...gjie-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@...gjie-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@...gjie-4-5-0-20201109195739-1 11:11:06 0000:00:0c.0]$ifdown eth3
[root@...gjie-4-5-0-20201109195739-1 11:11:13 0000:00:0c.0]$cat /sys/class/net/eth3/operstate
down
[root@...gjie-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: -
Powered by blists - more mailing lists