OPNsense Forum

English Forums => Development and Code Review => Topic started by: SimpleRezo on November 26, 2019, 01:47:45 am

Title: Plugin developpement - Question
Post by: SimpleRezo on November 26, 2019, 01:47:45 am
Hi

I working on an internal plugin for OPNSense (using MVC).

I have a small question: how can I run some code from my plugin everytime configd is started/restarted?

Thanks for your help!
Title: Re: Plugin developpement - Question
Post by: mimugmail on November 26, 2019, 05:46:24 am
Template generation runs everytime it starts. What exactly do you want to achieve?
Title: Re: Plugin developpement - Question
Post by: SimpleRezo on November 29, 2019, 12:05:10 am
I need to do some different "auto-init" of the plugin (after installation), and also, I want to notify a webhook of that event.

In brief, i need to run some code when configd is started/restarted :)
And with template generation, I don't see how I can do that since it's only producing files ...
Title: Re: Plugin developpement - Question
Post by: fabian on November 29, 2019, 06:41:44 am
https://github.com/opnsense/plugins/blob/master/sysutils/apuled/+POST_INSTALL
Title: Re: Plugin developpement - Question
Post by: fabian on November 29, 2019, 06:43:20 am
Q2: notifications on service starts are AFAIK not possible.
Title: Re: Plugin developpement - Question
Post by: SimpleRezo on November 29, 2019, 11:20:04 am
https://github.com/opnsense/plugins/blob/master/sysutils/apuled/+POST_INSTALL

Oh yeah, i didn't think about that option. Of course, it's not enough for what I want, but it helps, thank you.
(I will also use a basic rc.d script also for OS reboot)