Skip to content

Instantly share code, notes, and snippets.

@melyux
melyux / gist:b1a34262991e915f022dcd2461740ef0
Created Jun 11, 2021
Raspberry Pi - /etc/dhcpcd.enter-hook to disable Wi-Fi when Ethernet is plugged in and gets an IP address, and enable Wi-Fi on unplug
View gist:b1a34262991e915f022dcd2461740ef0
if [ "$reason" = "NOCARRIER" ] && [ "$interface" = "eth0" ]; then
rfkill unblock wifi
elif [ "$reason" = "BOUND" ] && [ "$interface" = "eth0" ]; then
rfkill block wifi
fi