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

    Run shell script on interface status change?

    General pfSense Questions
    2
    4
    2.8k
    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.
    • D
      Doktor Jones
      last edited by

      Is it possible to get pfSense to run a shell script when an interface's status changes (connected/disconnected, IP address change, etc)?

      I have a USB LED dongle that has a BSD command-line tool to change its color, and would like to change the color based on link status, but to do so I need to have a way to run that command-line tool when the status changes. I could run a cron job to check the status, but a) that only runs once per minute, and b) that would be running every minute, whether or not the link status has changed. If there's some script that runs when the interface status changes, I could simply add a line to it (calling my own script or whatever) and that would be much more efficient and useful.

      Thanks!

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        Look in /etc/devd.conf

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • D
          Doktor Jones
          last edited by

          Thanks for the pointer… would I use something like

          action /usr/local/bin/blink1-tool -m 50 --rgb 255,0,0
          

          to run the equivalent of

          $ blink1-tool -m 50 --rgb 255,0,0
          

          from the command line?

          1 Reply Last reply Reply Quote 0
          • jimpJ
            jimp Rebel Alliance Developer Netgate
            last edited by

            Yes though you would not want to remove the existing command, but run it also (should be OK to put a ; and then your command after the one there already)

            Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

            Need help fast? Netgate Global Support!

            Do not Chat/PM for help!

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