Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Run script on configuration change

    Scheduled Pinned Locked Moved General pfSense Questions
    5 Posts 2 Posters 384 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      NickSamNam
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by stephenw10

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

        Steve

        1 Reply Last reply Reply Quote 0
        • N
          NickSamNam
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • N
              NickSamNam
              last edited by

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

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.