Files
ugreen_dx4600_leds_controller/scripts/ugreen-power-led
Berthold Höllmann c33c05ae67
Some checks failed
Build kernel module for TrueNAS / build-and-run (push) Has been cancelled
Add support for setting power LED via systemctl (#60)
* Add support for setting power LED via systemctl

* Add documentation for rudimentary ugreen-power-led.service

* Add "Type=oneshot" and "RemainAfterExit=true" as suggested
2025-06-12 10:14:48 +08:00

31 lines
891 B
Bash

#!/usr/bin/bash
# use variables from config file (unRAID specific)
if [[ -f /boot/config/plugins/ugreenleds-driver/settings.cfg ]]; then
source /boot/config/plugins/ugreenleds-driver/settings.cfg
fi
# load environment variables
if [[ -f /etc/ugreen-leds.conf ]]; then
source /etc/ugreen-leds.conf
fi
# Blink settings for the power LED
# * none: no blinking
# * breath <delay_on> <delay_off>: breathing blink
# * blink <delay_on> <delay_off>: blinking
BLINK_TYPE_POWER=${BLINK_TYPE_POWER:="none"}
# brighness of the power LED
BRIGHTNESS_POWER=${BRIGHTNESS_POWER:=255}
# color of the power LED
COLOR_POWER=${COLOR_POWER:="255 255 255"}
# initialize LEDs
if [[ -d /sys/class/leds/power ]]; then
echo "$BLINK_TYPE_POWER" > /sys/class/leds/power/blink_type
echo "$BRIGHTNESS_POWER" > /sys/class/leds/power/brightness
echo "$COLOR_POWER" > /sys/class/leds/power/color
fi