2019-10-21 19:14:37 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Gets temperature of the CPU
|
|
|
|
# Dependencies: lm_sensors
|
|
|
|
|
2019-11-06 15:46:58 +00:00
|
|
|
PREFIX=' '
|
|
|
|
FIRE=' '
|
|
|
|
|
|
|
|
WARNING_LEVEL=80
|
|
|
|
|
2019-11-06 15:07:14 +00:00
|
|
|
get_cputemp()
|
2019-10-21 19:14:37 +00:00
|
|
|
{
|
|
|
|
# CPU_T=$(cat /sys/devices/platform/coretemp.0/hwmon/hwmon?/temp2_input)
|
|
|
|
# CPU_TEMP=$(expr $CPU_T / 1000)
|
|
|
|
|
2023-03-01 08:49:18 +00:00
|
|
|
CPU_TEMP="$(sensors | grep Package | awk 'NR==1{gsub("+", " "); gsub("\\..", " "); print $4}')"
|
2019-11-06 15:46:58 +00:00
|
|
|
|
2023-03-01 08:37:05 +00:00
|
|
|
if [[ "$CPU_TEMP" -ge $WARNING_LEVEL ]]; then
|
2019-11-06 15:46:58 +00:00
|
|
|
PREFIX="$FIRE$PREFIX"
|
|
|
|
fi
|
2019-10-21 19:14:37 +00:00
|
|
|
|
2019-11-06 15:46:58 +00:00
|
|
|
echo "$PREFIX$CPU_TEMP°C"
|
2019-10-21 19:14:37 +00:00
|
|
|
}
|
|
|
|
|
2019-11-06 15:07:14 +00:00
|
|
|
get_cputemp
|