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

Run shell script on interface status change?

Scheduled Pinned Locked Moved General pfSense Questions
4 Posts 2 Posters 2.8k 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.
  • D
    Doktor Jones
    last edited by Aug 26, 2013, 5:02 AM

    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
    • J
      jimp Rebel Alliance Developer Netgate
      last edited by Aug 26, 2013, 8:01 PM

      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 Aug 30, 2013, 7:51 PM

        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
        • J
          jimp Rebel Alliance Developer Netgate
          last edited by Aug 30, 2013, 7:55 PM

          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
          1 out of 4
          • First post
            1/4
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
            This community forum collects and processes your personal information.
            consent.not_received