Consider dtrace to monitor commands being executed to refresh service status #5
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Using dtrace to monitor commands being run on the host will allow Freedive to refresh services that are started or stopped directly from CLI. The other option is to poll each service at some interval, but that approach is slow to catch up or adds load to the host without providing justifiable benefit.
A similar approach is implemented by monitoring
/etc/rc.conf
,/etc/rc.d/
ad/usr/local/etc/rc.d/
for any changes to files that trigger service status refresh.def handle_info(
{:file_event, watcher_pid, {path, _events}},
%{watcher_pid: watcher_pid} = state
) do
name = Path.basename(path)
Logger.debug("Service.Server: handle_info file_event name: #{name}")
This will add a dependency ( https://hex.pm/packages/erlexec ) to monitor the dtrace command's output as a stream.
The feature can be implemented to internally broadcast the commands being run, which other features like services can subscribe to and react to relevant commands. Optionally log the commands to a separate log file such as
/var/log/freedive/commands