Long story short I've converted a Beelink Sei12 Mini PC into a 8TB all flash (1 NVMe, 1 SATA SSD) array unRAID server. The surrounding setup is a UniFi Dream Router, NetGear NightHawk M6 Pro (AT&T), and BLUETTI EB3A Power Station - all packaged into a neat milk crate so the all setup is ultra portable.
Currently whenever I am home, I plug in a USB NIC to the front USB-C port to allow it to get a local IP on the network which then I can rsync the latest library updates across.
Problem Statement: unRAID gets a little cranky when network adapters are added or removed while Docker is running; frankly the whole thing gets a bit finicky as even if up force the interface online (ifconfig eth1 up), the Web UI won't load.
Presently I've written a bash script that queries the number of current network devices when the system boots, and if it changes, reboot.
Question: Is there a better way? (Below is my script)
#!/bin/bash
if test -f "/tmp/current_nics.log"; then
current_nic_count=$(ifconfig -a | grep -i eth | grep -i mtu | wc -l)
previous_nic_count=$(cat /tmp/current_nics.log)
if [ "$current_nic_count" == "$previous_nic_count" ]; then
echo "No Change In Network"
else
echo "Network Changed; Rebooting"
/sbin/reboot
fi
else
ifconfig -a | grep -i eth | grep -i mtu | wc -l > /tmp/current_nics.log
echo "Default Network Count Being Set"
fi