AimerNeige revised this gist . Go to revision
1 file changed, 2 insertions, 1 deletion
gethddtemp.sh
@@ -16,4 +16,5 @@ if [[ $TEMP == '' ]]; then | |||
16 | 16 | fi | |
17 | 17 | echo $TEMP | |
18 | 18 | ||
19 | - | # https://askubuntu.com/questions/1426482/tool-to-monitor-hdd-temperature-in-ubuntu-server-22-04 | |
19 | + | # https://askubuntu.com/questions/1426482/tool-to-monitor-hdd-temperature-in-ubuntu-server-22-04 | |
20 | + | # ./gethddtemp.sh /dev/sda |
AimerNeige revised this gist . Go to revision
1 file changed, 19 insertions
gethddtemp.sh(file created)
@@ -0,0 +1,19 @@ | |||
1 | + | #!/bin/bash | |
2 | + | DRIVEPATH="$1" | |
3 | + | INFO="$(sudo smartctl -a $DRIVEPATH)" | |
4 | + | TEMP=$(echo "$INFO" | grep '194 Temp' | awk '{print $10}') | |
5 | + | if [[ $TEMP == '' ]]; then | |
6 | + | TEMP=$(echo "$INFO" | grep '190 Airflow' | awk '{print $10}') | |
7 | + | fi | |
8 | + | if [[ $TEMP == '' ]]; then | |
9 | + | TEMP=$(echo "$INFO" | grep 'Temperature Sensor 1:' | awk '{print $4}') | |
10 | + | fi | |
11 | + | if [[ $TEMP == '' ]]; then | |
12 | + | TEMP=$(echo "$INFO" | grep 'Current Drive Temperature:' | awk '{print $4}') | |
13 | + | fi | |
14 | + | if [[ $TEMP == '' ]]; then | |
15 | + | TEMP=$(echo "$INFO" | grep 'Temperature:' | awk '{print $2}') | |
16 | + | fi | |
17 | + | echo $TEMP | |
18 | + | ||
19 | + | # https://askubuntu.com/questions/1426482/tool-to-monitor-hdd-temperature-in-ubuntu-server-22-04 |