Skip to content

Instantly share code, notes, and snippets.

@melyux
melyux / gist:b1a34262991e915f022dcd2461740ef0
Created June 11, 2021 18:31
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
if [ "$reason" = "NOCARRIER" ] && [ "$interface" = "eth0" ]; then
rfkill unblock wifi
elif [ "$reason" = "BOUND" ] && [ "$interface" = "eth0" ]; then
rfkill block wifi
fi