WizardKit/archlive/airootfs/usr/local/bin/hw-diags-sensors
Alan Mason 8e36a24f37 2016-06: Retroactive Updates
* Added HW-Sensors alias and keyboard shortcut
* Added new packages to packages.both (from 2016.06 archiso update)
* Disabled gputests for i686 builds
* Errors would cause an incomplete line to be left in the log causing a false-positive
* HW-Diags will no longer upload results if the Ticket# starts with '0'
  * Added chmod flags to the rsync upload
* Initial work to add custom-repos
* Open GUI progs without entering a password (e.g. GParted)
* The wallpaper should now be loaded from the UFD.
  * Still need to move scripts or add a "settings" file
* mount-all-volumes now shows the mount-points while mounting (like running manually)
* photorec-sort 7z archive testing is currently stalling, disabled for now
2017-12-06 17:49:18 -08:00

42 lines
1.3 KiB
Bash

#!/bin/bash
#
## WK HW diagnostics - Sensors
LOG_DIR="$1"
function usage {
echo "Usage: $0 log-dir"
echo " e.g. $0 /tmp/tmp.7Mh5f1RhSL9001"
}
# Create directory if necessary
if [ ! -d "$LOG_DIR" ]; then
LOG_DIR="$(mktemp -d)"
fi
# Run Sensor loop
if sensors >/dev/null 2>&1; then
while :; do
sensors -A | grep -E -i -v '(N/A|RPM|\d+\s+V\s+|^\s*$)' > "$LOG_DIR/sensors.out" 2>/dev/null
# Colorize
# Blue: All temps (superseeded by other colors below)
sed -i -r 's#(\+[0-9]+\.[0-9].C)#\\e[34m\1\\e[0m#g' "$LOG_DIR/sensors.out" >/dev/null 2>&1
# Green >= 60* C
sed -i -r 's#(\+6[0-9]\.[0-9].C)#\\e[32m\1\\e[0m#g' "$LOG_DIR/sensors.out" >/dev/null 2>&1
# Yellow >= 70* C
sed -i -r 's#(\+7[0-9]\.[0-9].C)#\\e[33m\1\\e[0m#g' "$LOG_DIR/sensors.out" >/dev/null 2>&1
# Orange >= 80* C
sed -i -r 's#(\+(8[0-9]|9[0-4])\.[0-9].C)#\\e[31\;1m\1\\e[0m#g' "$LOG_DIR/sensors.out" >/dev/null 2>&1
# Red >= 95* C
sed -i -r 's#(\+(9[5-9]|1[0-9][0-9])\.[0-9].C)#\\e[31m\1\\e[0m#g' "$LOG_DIR/sensors.out" >/dev/null 2>&1
# Output data
clear
echo -e "$(cat "$LOG_DIR/sensors.out")"
sleep 1s
done
else
echo -e "\e[33mNo sensors found!\nPlease monitor temperatures manually\e[0m"
sleep 1h
fi