Files
2025-09-12 09:31:37 +00:00

22 lines
626 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
# try to find temperature of cpu
for thermal_zone in /sys/devices/virtual/thermal/thermal_zone*; do
[ -d "$thermal_zone" ] || continue
if [[ "$(cat $thermal_zone/type)" =~ '(cpu|soc|package)-thermal' ]]; then
TEMP="$(cat $thermal_zone/temp)"
break
fi
done
# fallback to highest temperature
if [ -z "$TEMP" ]; then
TEMP=$(cat /sys/devices/virtual/thermal/thermal_zone*/temp | sort -n | tail -1)
fi
echo "$(($TEMP / 1000)) C"