mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 15:43:06 +02:00
git-subtree-dir: linux_configuration git-subtree-mainline:11427631cdgit-subtree-split:0762e3d07b
27 lines
671 B
Bash
Executable File
27 lines
671 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Get the first temp1 value from sensors
|
|
temp=$(sensors | awk '/^temp1:/ {print $2; exit}' | tr -d '+°C')
|
|
|
|
# Ensure the temperature is a valid number
|
|
if [[ ! $temp =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
|
|
echo " MB: N/A"
|
|
echo
|
|
echo "#FF5555" # Red color for error
|
|
exit 1
|
|
fi
|
|
|
|
# Define temperature thresholds
|
|
if (($(echo "$temp < 50.0" | bc -l))); then
|
|
color="#50FA7B" # Green for OK temperature
|
|
elif (($(echo "$temp < 70.0" | bc -l))); then
|
|
color="#F1FA8C" # Yellow for warning temperature
|
|
else
|
|
color="#FF5555" # Red for high temperature
|
|
fi
|
|
|
|
# Output the temperature with the color
|
|
echo " ${temp}°C" # is a thermometer icon
|
|
echo
|
|
echo $color
|