feat: Monitoring client

This commit is contained in:
Jan-Bulthuis 2025-08-09 23:10:49 +02:00
parent cecccf2574
commit 1c9b1893c4

14
monitor.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
interface="${MADD_INTERFACE:-"eth0"}"
client_script="${MADD_CLIENT_SCRIPT:-"./client.sh"}"
ip monitor address label dev "$interface" | while read event; do
if [[ $event == \[ADDR\]* ]]; then
ipv4=$(ip addr show dev "$interface" | grep -Po 'inet \K[\d.]+')
if [ -n "$ipv4" ]; then
export MADD_IP="$ipv4"
$client_script
fi
fi
done