Run shell script on interface status change?
-
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!
-
Look in /etc/devd.conf
-
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?
-
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)