Created
November 18, 2014 05:54
-
-
Save t-chab/c9c56295687c0a4abc7a to your computer and use it in GitHub Desktop.
Shell script which log temperature to a temp file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# sensors, hddtemp and nvidia-smi commands should be in path | |
CORE0_TEMP=$(sensors | grep 'Core 0' | awk -F':' '{print $2}' | awk -F'(' '{print $1}' |tr -d ' +') | |
CORE1_TEMP=$(sensors | grep 'Core 1' | awk -F':' '{print $2}' | awk -F'(' '{print $1}' |tr -d ' +') | |
HDD_TEMP=$(hddtemp /dev/sdb |awk '{ print $3}') | |
GPU_TEMP=$(nvidia-smi -a |grep "GPU Current Temp" |awk '{ print $5}') | |
OUT_FILE=/tmp/$(date +%Y-%m-%d).temp.log | |
DATETIME=$(date +"%Y-%m-%d %T") | |
echo "$DATETIME; $CORE0_TEMP; $CORE1_TEMP; $HDD_TEMP; $GPU_TEMP°C;" >> $OUT_FILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment