Closed pniaps closed 2 years ago
https://github.com/openwisp/openwisp-config/pull/180
@pniaps Does this solve this issue for you?
I have taken a first look at it and it should be valid.
Basically it is the same to write a file in /etc/openwisp/post-reload-hook.d/do-something as in /etc/hotplug.d/openwisp/do-something.
In fact it is better, because with hotplug you can execute things in different events in the same file, while in this proposal you should create a file for each event.
Thanks.
Currently there are 3 possible hooks,
pre-reload-hook
,post-reload-hook
,post-registration-hook
.Sometimes, you need to add code to execute in a hook from a template, but this is a problem when you need to add code from multiple templates.
A possible solution would be to have a
*-hook.d
folder where each template can place his custom code.Something similar to
extracted from OpwnWRT hotplug-call
Also, this paths are configurable. One solution would be to execute the configured file if exists and also search for scripts in a folder with the same name and
.d
suffix.