While working with scripting in ROS we have to revert to scheduler have a script being executed in a interval or on startup. This leaves time before a script can detect a change and make the its own changes in the setting or give a warning to the user.
My proposal is to give each path/option a unique identifier and sent that on any edit/create/remove/disable to an new script collection. The new script collection could looks like schedule, but it is only search for a matching script with the unique number as identifier.
O Noooooo, not that also!!! Changes made by ROS like with Netwatch, in paths that are read-only should be able to trigger a script. Think of /user/active keeping track of users being logged in.
The “event-list” should receive the following data:
- unique number for finding and start the appropriate script, if present
- path (example: path=/interface/wireguard/peers/)
- .id, the line being effected (example: id=*5)
- type of change (add/delete/edit/(disable/update))
The unique identifier is available in every menu suited for this and if already every option has an unique identifier then make this available to the user to be copied.
The “event-list” should have two fields, the unique identifier and a settable time-out. The timeout is there to have an delay before the script is being executed. This because often a user edits a change or edit shortly after confirming. So the script execution can be delay, if an edit is made then the second “trigger” will reset the timeout and the clock starts to run again.
I hope that the unique identifier is already present in ROS and that can be implemented without much effort. I advise to do it graduate release of the identifiers.
ANY thought, suggestions or complaints feel free to post those here and I am only interested in having Mikrotik a good input for this so that it is also attractive for them to implement it.
Update: as unique identifier you can also think of the converting the path to an hash. There is a short version of paths so it can be made fitting.
Also indicate in each menu, I am using WinBox, that an event-list entry is active for this menu. An apply or OK will trigger the event-list.