mirror of
https://github.com/miskcoo/ugreen_dx4600_leds_controller.git
synced 2025-07-23 12:23:09 +02:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c33c05ae67 | ||
|
dc04db484c | ||
|
276ae34cd1 | ||
|
af2b3c327a |
@@ -210,11 +210,13 @@ Please see `scripts/ugreen-leds.conf` for an example.
|
||||
# change enp2s0 to the network device you want to monitor
|
||||
systemctl start ugreen-netdevmon@enp2s0
|
||||
systemctl start ugreen-diskiomon
|
||||
systemctl start ugreen-power-led
|
||||
|
||||
# if you confirm that everything works well,
|
||||
# run the command below to make the service start at boot
|
||||
systemctl enable ugreen-netdevmon@enp2s0
|
||||
systemctl enable ugreen-diskiomon
|
||||
systemctl enable ugreen-power-led
|
||||
```
|
||||
|
||||
- (_Optional_) To reduce the CPU usage of blinking LEDs when disks are active, you can enter the `scripts` directory and do the following things:
|
||||
|
13
scripts/systemd/ugreen-power-led.service
Normal file
13
scripts/systemd/ugreen-power-led.service
Normal file
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=UGREEN LEDs daemon for configuring power LED
|
||||
After=ugreen-probe-leds.service
|
||||
Requires=ugreen-probe-leds.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/ugreen-power-led
|
||||
RemainAfterExit=true
|
||||
StandardOutput=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@@ -274,10 +274,13 @@ if [ "$CHECK_SMART" = true ]; then
|
||||
|
||||
dev=${devices[$led]}
|
||||
|
||||
/usr/sbin/smartctl -H /dev/${dev} -n standby,1 &> /dev/null
|
||||
# read the smart status return code, but ignore if the drive is on standby
|
||||
/usr/sbin/smartctl -H /dev/${dev} -n standby,0 &> /dev/null
|
||||
RET=$?
|
||||
|
||||
if [[ $RET -gt 1 ]]; then
|
||||
# check return code for critical errors (any bit set except bit 5)
|
||||
# possible return bits set: https://invent.kde.org/system/kpmcore/-/merge_requests/28
|
||||
if (( $RET & ~32 )); then
|
||||
echo "$COLOR_SMART_FAIL" > /sys/class/leds/$led/color
|
||||
echo Disk failure detected on /dev/$dev at $(date +%Y-%m-%d' '%H:%M:%S)
|
||||
continue
|
||||
|
@@ -110,3 +110,17 @@ COLOR_NETDEV_LINK_10000="255 255 255"
|
||||
|
||||
# color of the netdev when unable to ping the gateway
|
||||
COLOR_NETDEV_GATEWAY_UNREACHABLE="255 0 0"
|
||||
|
||||
# =========== parameters for power LED ===========
|
||||
|
||||
# Blink settings for the power LED
|
||||
# * none: no blinking (default)
|
||||
# * breath <delay_on> <delay_off>: breathing blink
|
||||
# * blink <delay_on> <delay_off>: blinking
|
||||
BLINK_TYPE_POWER="none"
|
||||
|
||||
# brighness of the power LED (default: 255)
|
||||
BRIGHTNESS_POWER=255
|
||||
|
||||
# color of the power LED (default: 255 255 255)
|
||||
COLOR_POWER="255 255 255"
|
||||
|
30
scripts/ugreen-power-led
Normal file
30
scripts/ugreen-power-led
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/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
|
Reference in New Issue
Block a user