You are not logged in.
Hai thar,
I'm trying to write a little dongle that does magic when the file in /sys changes. I want it to go like this:
Watch the file, let's say '/sys/devices/platform/coretemp.0/temp2_input'.
When the file content was modified, open that file and yank the current value and do magic.
Rinse, repeat
I'm using pyinotify library for this, and there is the code snip i'm testing currently:
wm = pyinotify.WatchManager()
notify = pyinotify.Notifier(wm)
wm.add_watch('/sys/devices/platform/coretemp.0/temp2_input', pyinotify.ALL_EVENTS)
notify.loop()
The problem is, i can't seem to get any kind of response out of this. The file content keeps changing, but inotify is dead silent. When i cat this file, it shows all events like it should, but it's not what i want obviously.
Is that even possible? If yes, can you give me a hint about what i'm doing wrong?
Last edited by kaszak696 (2013-02-12 15:53:49)
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
You need to use inotifywait instead.
Offline
You need to use inotifywait instead.
Same behavior.
I'm wondering if it's because these are not the 'real' files, just a representation of data from the kernel.
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline
Offline
I see, thanks.
I'm gonna stick with reading the file at interval inside a while loop.
'What can be asserted without evidence can also be dismissed without evidence.' - Christopher Hitchens
'There's no such thing as addiction, there's only things that you enjoy doing more than life.' - Doug Stanhope
GitHub Junkyard
Offline