dotfiles/.config/dwm/scripts/cpu_info.sh

21 lines
947 B
Bash
Raw Normal View History

2022-04-29 00:02:04 +02:00
#!/bin/sh
check_sensor=$(sensors | grep "Tdie:" 2> /dev/null)
if [ -z "${check_sensor}" ] ; then
check_sensor=$(sensors | grep "Tctl:" 2> /dev/null)
if [ -z "${check_sensor}" ] ; then
2022-08-04 19:11:02 +02:00
CPU_USAGE=$(~/.config/dwm/scripts/cpu_load.sh -p)
2022-05-22 01:17:37 +02:00
echo "$CPU_USAGE" | awk '{ printf("%6s \n"), $1, $2 }'
2022-04-29 00:02:04 +02:00
else
TEMP=$(sensors | grep 'Package id 0:\|Tctl' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
2022-08-04 19:11:02 +02:00
CPU_USAGE=$(~/.config/dwm/scripts/cpu_load.sh -p)
2022-05-22 01:17:37 +02:00
echo "$CPU_USAGE $TEMP" | awk '{ printf("%6s @ %s \n"), $1, $2 }'
2022-04-29 00:02:04 +02:00
fi
else
TEMP=$(sensors | grep 'Package id 0:\|Tdie' | grep ':[ ]*+[0-9]*.[0-9]*°C' -o | grep '+[0-9]*.[0-9]*°C' -o)
#CPU_USAGE=$(mpstat 1 1 | awk '/Average:/ {printf("%s\n", $(NF-9))}')
2022-08-04 19:11:02 +02:00
CPU_USAGE=$(~/.config/dwm/scripts/cpu_load.sh -p)
2022-05-22 01:17:37 +02:00
echo "$CPU_USAGE $TEMP" | awk '{ printf("%6s @ %s \n"), $1, $2 }'
2022-04-29 00:02:04 +02:00
fi