Raspberry Pi LEDs abschalten
4B
https://smarthomescene.com/guides/how-to-disable-leds-on-raspberry-pi-3b-4b/
#!/bin/bash
tmp_file=$(mktemp)
# Read the original file, add new lines after initial comments, and write to temp file
awk '
BEGIN {printed=0}
/^[^#]/ && !printed {
print "# Turn off LEDs"
print "dtparam=pwr_led_trigger=default-on"
print "dtparam=pwr_led_activelow=off"
print "dtparam=act_led_trigger=none"
print "dtparam=act_led_activelow=off"
print "dtparam=eth_led0=4"
print "dtparam=eth_led1=4"
printed=1
}
{print}
' /boot/firmware/config.txt > "$tmp_file"
# Check if the operation was successful
if [ $? -eq 0 ]; then
sudo cp /boot/firmware/config.txt /boot/firmware/config.txt.bak
sudo mv "$tmp_file" /boot/firmware/config.txt
echo "Lines added successfully. Original file backed up as /boot/firmware/config.txt.bak"
else
echo "An error occurred while processing the file."
rm "$tmp_file"
exit 1
fi