This commit is contained in:
biss committed 2026-09-08 20:01:03 +08:00
commit 645c461d2a
12 files changed
+886

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
config scheduler 'main'
option enabled '0'
option off_time '23:00'
option on_time '07:00'
option all_system_leds '1'
+16
View File
@@ -0,0 +1,16 @@
#!/bin/sh
case "$ACTION" in
step|stratum)
[ -x /usr/bin/led-control ] || exit 0
year="$(date +%Y 2>/dev/null)"
[ -n "$year" ] || exit 0
[ "$year" -ge 2024 ] 2>/dev/null || exit 0
/usr/bin/led-control apply >/dev/null 2>&1
logger -t led-scheduler "schedule reapplied after NTP event: $ACTION"
;;
esac
exit 0
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh /etc/rc.common
START=99
STOP=10
time_is_sane() {
local year
year="$(date +%Y 2>/dev/null)"
[ -n "$year" ] || return 1
[ "$year" -ge 2024 ] 2>/dev/null
}
start() {
/usr/bin/led-control sync >/dev/null 2>&1
# Keep LEDs in their normal OpenWrt state until the clock is trustworthy.
/usr/bin/led-control on >/dev/null 2>&1
if time_is_sane; then
/usr/bin/led-control apply >/dev/null 2>&1
else
logger -t led-scheduler "boot clock not synchronized; waiting for NTP"
fi
}
reload() {
start
}
restart() {
start
}
stop() {
/usr/bin/led-control clear-cron >/dev/null 2>&1
/usr/bin/led-control on >/dev/null 2>&1
}