Files
NANOKVM-LicheeRV-Nano-Build…/buildroot/board/cvitek/SG200X/overlay/etc/init.d/S99temptest
2025-01-14 11:03:07 +08:00

48 lines
882 B
Bash
Executable File

#!/bin/sh
GREEN=0xFF00FF00
RED=0xFFFF0000
case "$1" in
start)
printf "Starting temptest: "
if [ -e /boot/temptest ]
then
touch /tmp/temptest
fi
(
while true
do
if [ ! -e /tmp/temptest ]
then
break
fi
colorbg=0xFF000000
soc_temp=$(cat /sys/class/thermal/thermal_zone0/temp)
if [ "${soc_temp}" -le 75000 ]
then
colorfg=$GREEN
else
colorfg=$RED
fi
echo "soc temp: $soc_temp" | fbbar 32 $colorfg $colorbg
colorfg=0xFFFFFFFF
echo "soc id: $(cat /device_key_legacy)" | fbbar 48 $colorfg $colorbg
sleep 1
done
) &
[ $? = 0 ] && echo "OK" || echo "FAIL"
;;
stop)
printf "Stopping temptest: "
rm /tmp/temptest
echo "OK"
;;
restart)
printf "Restart temptest: "
$(realpath ${0}) stop
$(realpath ${0}) start
echo "OK"
;;
esac