
Can also optionally monitor CPU temperature, and control fan speed accordingly.
A least one SATA hard drive, that supports. exposes to the OS a PWM to control fan speed. exposes to the OS a sensor to query fan speed. Some Linux distributions have a hddfancontrol package available in their repository: Most motherboards and SATA drives fit these requirements. If you don't already have it, install pip for Python 3. Install HDD Fan control: pip3 install hddfancontrol.
On Ubuntu and other Debian derivatives: sudo apt-get install hdparm hddtemp.
If you don't already have it, install setuptools for Python 3. Install HDD Fan control: python3 setup.py install. To query fan characteristics, you may also need pwmconfig. On Ubuntu and other Debian derivatives, it is part of the fancontrol package, that you can install with sudo apt-get install fancontrol. HDD fancontrol and fancontrol are unrelated. The fancontrol daemon is not needed for HDD fan control to operate. If you use both fancontrol and HDD fancontrol, be careful not to make them control the same fans. Use a value for the -i/ -interval parameter higher than your SATA spin down time (not recommended unless your spin down time is very low, ie 50☌, and run them a 20% speed if < 30☌, which corresponds to the usual recommended drive operating temperature.
In that case you do not need to use hddfancontrol's -spin-down-time switch, because the builtin SATA drive timeout (that you can set for example with hdparm -S XXX command) should take effect.