-
-
Notifications
You must be signed in to change notification settings - Fork 60
Description
When doing an operation on a service with dinitctl, it would be handy if dinitctl would warn when the service file has changed since the time it was first loaded. Since watching for file changes is a non-portable operation, this could be optional.
An approach I had in mind would be to use the Linux inotify interface (a BSD kqueue version could also exist, etc.) to watch service directories and keep the info attached to the service object; then pass it over the protocol when issuing FINDSERVICE or LOADSERVICE. This could be done by issuing a special event before returning the handle (as compliant protocol implementations are expected to ignore them at any point, this should be fine); or by attaching it to the FINDSERVICE/LOADSERVICE result. The latter is possibly more practical but the current protocol is restrictive in the sense it does not allow passing flags on the request, and it does not have enough space in the response to avoid breaking the existing protocol.
Either way, upon reception of this info, dinitctl could print a warning that the service file has changed and that one may want to reload.
Thoughts?