Files
2026-09-08 20:01:03 +08:00

38 lines
639 B
Bash

#!/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
}