Friday, March 19, 2010

於Linux中偵測HD溫度

原文eliu兄分享的方法延伸出再多一點的應用如下:

1. 將HD溫度每60秒紀錄在/var/log/message中:
# hddtemp -d /dev/hda -S 60
Mar 19 15:08:54 server hddtemp[3253]: /dev/hda: ST320011A: 33 C
Mar 19 15:09:54 server hddtemp[3253]: /dev/hda: ST320011A: 33 C

2. 開機時啟動hddtemp:
# vi /etc/sysconfig/hddtemp
HDDTEMP_OPTIONS="-l 192.168.0.1 -d /dev/hda -S 60"
#-l: listen on a specific interface (in TCP/IP daemon mode)
#-d: run hddtemp in TCP/IP daemon mode (port 7634 by default.)
#-S: log temperature to syslog every s seconds.

# /etc/init.d/hddtemp start
# chkconfig hddtemp on

3. 透過另一台主機即時監看HD溫度:
# while true; do date +%F-%H-%M-%S;nc 192.168.0.1 7634;echo"";sleep 1; done
2010-03-19-15-13-23
|/dev/hda|ST320011A|33|C|
2010-03-19-15-13-24
|/dev/hda|ST320011A|33|C|
2010-03-19-15-13-25
|/dev/hda|ST320011A|33|C|
2010-03-19-15-13-26
|/dev/hda|ST320011A|33|C|
2010-03-19-15-13-27
|/dev/hda|ST320011A|33|C

No comments: