Skip to content

Instantly share code, notes, and snippets.

@csrutil
Created July 14, 2024 12:25
Show Gist options
  • Save csrutil/a4945d7c79ae97d1bb13c78a1cbc02c7 to your computer and use it in GitHub Desktop.
Save csrutil/a4945d7c79ae97d1bb13c78a1cbc02c7 to your computer and use it in GitHub Desktop.
#!/bin/sh
# /etc/network/if-up.d
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# /sys/devices/platform/gpio-leds/leds
echo cpu > /sys/devices/platform/gpio-leds/leds/green\:sys/trigger
[ "$IFACE" != "lo" ] || exit 0
if [ "$IFACE" = "eth0" ]; then
echo heartbeat > /sys/devices/platform/gpio-leds/leds/green\:lan/trigger
elif echo "$IFACE" | grep -q "enp"; then
echo heartbeat > /sys/devices/platform/gpio-leds/leds/green\:wan/trigger
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment