Files
ServerManagementUtils/metrics/temperature.sh
T

16 lines
463 B
Bash

#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. "${SCRIPT_DIR}/../share/logging.sh"
LOGFILE=/var/log/temperature.log
touch "$LOGFILE"
chmod 644 "$LOGFILE"
for i in {1..6}; do
timestamp=$(GetTimestamp)
paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/' | while read line; do
echo "$timestamp $line" >> "$LOGFILE"
done
sleep 10
done