On Tue, Nov 10, 2020 at 8:32 PM 杜英杰 <leon...@pku.edu.cn> wrote: > > 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!
You need to listen to netdev netlink messages for changes like this. These messages are generated in real-time. Thanks.