Raspberry Pi – Running script on network interface Up with Raspbian 9

I use a Raspberry connected to a big screen on the wall as a dashboard. It’s IP address change from time to time and I wanna be notified on Slack about the new IP. So every time its wifi gets a new IP, dhcpcd triggers a hook that post to a Slack channel where I installed a WebHook App.

The script location is /lib/dhcpcd/dhcpcd-hooks/notify_ip_to_slack.sh and it looks like this:

https://gist.github.com/maatthc/ec4505a0ef10b9fb5e6fba9c74803d63

Notice that it only runs for events “up” on the interface “wlan0”.

Leave a Reply

Your email address will not be published. Required fields are marked *