Run script on configuration change



  • If I understand correctly, pfSense generates config files for services from the pfSense config. At the moment I have a script which runs on boot, which edits the dhcpd.conf file. Would it be possible to run that script any time pfSense regenerates dhcpd.conf, like when DHCP settings are altered from the GUI? If so, could you tell me how?


  • Netgate Administrator

    You could run it via shellcmd using the afterfilterchangeshellcmd type. That would run on most config changes.

    Steve



  • Thank you for your suggestion! Unfortunately it is not triggered when DHCP configuration changes are made. But at least I can easily trigger it manually now, by clicking the 'Reload Filters' button.


  • Netgate Administrator

    Mmm, I think that's probably the only option that's within the normal pfSense config options.
    Otherwise you could put a hook into the write_config() function but that will be lost at upgrade.

    Steve



  • I really like the persistence of the shellcmd solution, so I'll stick with that. Thank you very much for your help!


Log in to reply