Closed aparcar closed 6 years ago
You can use some inotify library to for being triggered by respective events. From bash for example this may look like (apt-get install inotify-tools): inotifywait -e modify -r --timefmt "%s%u" --format "%T %w%f %e " /var/run/bmx7/json/originators/ which terminates as soon as any file got changed. By default originator files are updated every --jsonUpdateInterval=60000 ms to periodically update the current metric. If you want them to change (and be triggered only) when route changes set --jsonUpdateInterval to its maximum. Setting it to '0' will only notify if the description changed. But in that case you could also watch /var/run/bmx7/json/descriptions. There are respective libraries for most programming language. Please close issue if such approach satisfies your demand.
@axn I'd rather create a plugin that handles it instead of installing inotifywait on the devices, don't you think?
not sure. The mentioned bash programs should be pretty small. Probably at the same size as another bmx7 plugin. Also depends which language you want to use which may come with appropriate binaries already. Calling executables from bmx7 would likely require threading or bmx7 gets blocked while executing the extenal code and then hope that the call eventually returns. In short I am a bit reluctant if other way is also possible.
Okay let's close this
I could not find an alternative to inotify for OpenWrt. Another possibility would be to run every n
seconds a script to check changes, but that feels somewhat like a hack. Do you see any other options @axn?
What about the inotifywait solution you used here: https://github.com/openwrt/packages/pull/5923/files#diff-84e3cba3ad0824677d2bf371741fded1R17 ?
Should be fixed
odhcpd runs a trigger when new leases are created. If possible I'd like to use such a feature in bmx7 on new originators.
Context is that I'm developing a monitoring setup based on bmx7 and I'd like to trigger the monitoring instance to automatically reload on new originators.
I'd like the use of the following functions:
both could run a user defined shell script supplying the parameters above. The scripts should be non blocking.