Search code examples
pythonlinuxhard-drivetemperature

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?


Solution

  • 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.