1. Neue Datei erstellen: sudo nano /etc/init.d/leds
Inhalt der Datei „leds“:
#!/bin/bash
case „$1“ in
start)
echo 0 > /sys/class/leds/blue:ph21:led1/brightness
echo „Switching off Blue LED“
echo 0 > /sys/class/leds/white:ph11:led3/brightness
echo „Switching off White LED“
echo 0 > /sys/class/leds/green:ph07:led4/brightness
echo „Switching off Green LED“
echo 0 > /sys/class/leds/orange:ph20:led2/brightness
echo „Switching off Orange LED“
;;
stop)
echo 1 > /sys/class/leds/blue:ph21:led1/brightness
echo „Switching on Blue LED“
echo 1 > /sys/class/leds/white:ph11:led3/brightness
echo „Switching on White LED“
echo 1 > /sys/class/leds/green:ph07:led4/brightness
echo „Switching on Green LED“
echo 1 > /sys/class/leds/orange:ph20:led2/brightness
echo „Switching on Orange LED“
;;
*)
echo „Usage: /etc/init.d/leds {start|stop}“
exit 1
;;
esac
case „$1“ in
start)
echo 0 > /sys/class/leds/blue:ph21:led1/brightness
echo „Switching off Blue LED“
echo 0 > /sys/class/leds/white:ph11:led3/brightness
echo „Switching off White LED“
echo 0 > /sys/class/leds/green:ph07:led4/brightness
echo „Switching off Green LED“
echo 0 > /sys/class/leds/orange:ph20:led2/brightness
echo „Switching off Orange LED“
;;
stop)
echo 1 > /sys/class/leds/blue:ph21:led1/brightness
echo „Switching on Blue LED“
echo 1 > /sys/class/leds/white:ph11:led3/brightness
echo „Switching on White LED“
echo 1 > /sys/class/leds/green:ph07:led4/brightness
echo „Switching on Green LED“
echo 1 > /sys/class/leds/orange:ph20:led2/brightness
echo „Switching on Orange LED“
;;
*)
echo „Usage: /etc/init.d/leds {start|stop}“
exit 1
;;
esac
2. mit CTRL + X speichern und raus aus dem File
3. Script / Datei ausführbar machen: sudo chmod 755 /etc/init.d/leds
4. Testen (LED aus): sudo /etc/init.d/leds start
5. Testen (LED an): sudo /etc/init.d/leds stop
6. Datei / Script für Autostart bei Systemstart registrieren: sudo update–rc.d leds defaults
Das war´s 🙂