Looking at 20-openvpn there it looks like two variables are expected, where the 2nd one is either MASTER or BACKUP, presumably passed to each script in this directory just when carp switches status. The first variable gets read as "subsystem," presumably something about the identity of what triggered the carp status change. I also see
https://docs.opnsense.org/development/backend/autorun.html as reference.
Several questions then:
What are the possible (sane) subsystems for this context? Are there known problem cases to beware of here in the context of taking action, or is it generally safe to ignore this value beyond perhaps logging it?
Are scripts in carp run on initial system startup, just if the system starts up as MASTER?
Thanks!
Are there docs pertinent to this deeper functionality somewhere? Is it specific to OPNsense, or inherited from somewhere upstream?
Then here I'm seeing a suggestion that the existing "openvpn" file there is misnamed:
https://www.bountysource.com/issues/65768122-carp-events-notifications-can-be-in-separate-file
What direction is this going now?
Devd is responsible for triggering the events and arguments:
https://github.com/opnsense/core/blob/master/src/etc/devd/carp.conf
If you want to know more look at FreeBSD directly:
# man carp
# man devd
Cheers,
Franco