1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Linux端末でCPU温度をロギングする

Posted at

概要

とある用途で使っていたLinux端末が熱暴走したことをきっかけに、Linux端末のCPU温度をロギングをするShell Scriptを書いた。

check_cpu_temp.sh
# !/bin/sh
ulimit -c unlimited
date=`date +"%Y-%m-%d"`
status=`date +"%Y-%m-%d %H:%M"`
status=${status}" "`cat /sys/class/thermal/thermal_zone0/temp`

echo ${status} >> ./log/${date}.log

基本的に、/sys/class/thermal/thermal_zone0/tempを読んでCPU温度を取得し、日付ごとのログファイルに書き込む。
利用時は、このShellScriptをcronで定期実行してロギングしている。

注意:

ロギングされる温度は1000倍されています(摂氏[℃]に変換するには1/1000倍してください)

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?