Fixes to temperature

This commit is contained in:
Alexandru-Victor Macocian
2025-10-30 17:47:35 +01:00
parent c34f32ea84
commit 4ac76bca4d
2 changed files with 9 additions and 2 deletions
+7 -1
View File
@@ -33,13 +33,19 @@ for i in {1..6}; do
timestamp=$(GetTimestamp)
if [[ "$OS_TYPE" == "macos" ]]; then
# Try osx-cpu-temp first
# Try osx-cpu-temp first (check both PATH and common install location)
if command -v osx-cpu-temp &> /dev/null; then
temp_output=$(osx-cpu-temp 2>/dev/null)
if [[ $? -eq 0 && -n "$temp_output" ]]; then
# Output format: "50.0°C"
echo "$timestamp CPU $temp_output" >> "$LOGFILE"
fi
elif [[ -x /usr/local/bin/osx-cpu-temp ]]; then
temp_output=$(/usr/local/bin/osx-cpu-temp 2>/dev/null)
if [[ $? -eq 0 && -n "$temp_output" ]]; then
# Output format: "50.0°C"
echo "$timestamp CPU $temp_output" >> "$LOGFILE"
fi
# Fallback to powermetrics (requires sudo)
elif [[ -x /usr/bin/powermetrics ]]; then
# Run powermetrics for 1 second and extract temperature
+2 -1
View File
@@ -119,7 +119,8 @@ IsThermalMonitoringSupported() {
case "$os" in
macos)
# Check if osx-cpu-temp or powermetrics is available
command -v osx-cpu-temp &> /dev/null || [[ -x /usr/bin/powermetrics ]]
# Check both PATH and common install locations
command -v osx-cpu-temp &> /dev/null || [[ -x /usr/local/bin/osx-cpu-temp ]] || [[ -x /usr/bin/powermetrics ]]
;;
linux)
# Check if thermal zones exist