最後活躍 1744391737

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