Created
January 24, 2022 02:33
-
-
Save jacobkossman/03095f67b02845a27a5602b51558b607 to your computer and use it in GitHub Desktop.
HDD Drive Temps
This file contains 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
#! /bin/sh | |
logslocation="/folderforlogshere/" | |
for i in $(sysctl -n kern.disks) | |
do | |
logfile="${logslocation}disk-${i}.log" | |
DiskSerNum=`smartctl -a /dev/$i | awk '/Serial Number:/{print $0}' | awk '{print $3}'` | |
DiskName=`smartctl -a /dev/$i | awk '/Device Model:/{print $0}' | awk '{print $3}'` | |
echo $DiskSerNum $DiskName >> $logfile | |
echo "-------------" >> $logfile | |
echo "" >> $logfile | |
done |
This file contains 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
#! /bin/sh | |
logslocation="/folderforlogshere/" | |
timestamp() { | |
date +"%Y-%m-%d %H-%M-%S" | |
} | |
for i in $(sysctl -n kern.disks) | |
do | |
logfile="${logslocation}disk-${i}.log" | |
DiskTemp=`smartctl -a /dev/$i | awk '/Temperature_Celsius/{print $0}' | awk '{print $10 "C"}'` | |
echo [$(timestamp)] $DiskTemp >> $logfile | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment