Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get hard disk temperature using Python

I would like to get the temperature of a hard disk using Python (under Linux). I'm currently calling hddtemp with subprocess.popen, but I call it often enough that it is a performance bottleneck in my script. I think it should be possible to do something similar to question 4193514?

like image 932
lyineyes Avatar asked Jan 16 '23 19:01

lyineyes


1 Answers

You can run hddtemp as a daemon (the -d option), then use sockets to query it - defaults to port 7634.

Edit: see some code that does this.

like image 53
Hugh Bothwell Avatar answered Jan 24 '23 21:01

Hugh Bothwell