LunaFan Control is a lightweight daemon for managing fan speeds in Linux based on CPU temperature or other sensors. Written in Go, it uses JSON configuration for flexible fan speed curve customization. It serves as an alternative to fancontrol with an emphasis on simplicity and precision.
- Simple setup via JSON config.
- Linear interpolation for smooth fan control.
- Support for multiple fans with individual curves.
- Systemd integration for running in the background.
- Commands to start, stop, view status, and switch configs.
- Easily adaptable to different hardware (requires hwmon path configuration).
- Linux with access to
/sys/class/hwmon(typically provided by the kernel). - Go 1.16+ (for building from source).
- For Arch Linux:
makepkg(optional, for creating a package). - Root privileges to write to
/sys/class/hwmonand install the service.
- Ensure Go is installed:
go version. - Clone the repository:
git clone https://github.com/dmitrymodder/lunafan-control.git cd lunafan-control - Build the binary:
make build
- Install the program and service:
sudo make install
- Clone the repository:
git clone https://github.com/dmitrymodder/lunafan-control.git cd lunafan-control - Build and install the package:
make package sudo pacman -U lunafan-control-*.pkg.tar.zst
To remove temporary files and folders (pkg, src, packages):
make clean- Edit
/etc/lunafan-control/config.jsonfor your hardware:temp_sensor: path to the temperature file (example,/sys/class/hwmon/hwmon1/temp1_input).fans: list of fans with paths to PWM (pwm_path), RPM (input_path) and speed curves (curve).- Exaple config:
{ "temp_sensor": "/sys/class/hwmon/hwmon1/temp1_input", "update_interval_ms": 5000, "fans": [ { "name": "cpu", "pwm_path": "/sys/class/hwmon/hwmon3/pwm2", "input_path": "/sys/class/hwmon/hwmon3/fan2_input", "curve": [ {"temp": 35, "percent": 20}, {"temp": 50, "percent": 35}, {"temp": 75, "percent": 100} ] } ] }
- To switch between configs, create files in
/etc/lunafan-control/configs/and use:lunafan-control config <config_name>
- Start the service:
sudo lunafan-control start
- Stop the service:
sudo lunafan-control stop
- Enable auto-start:
sudo lunafan-control enable - Check status (temperature and RPM):
lunafan-control stats
- Run in foreground for debugging:
sudo lunafan-control run
To find the correct paths for temp_sensor, pwm_path and input_path:
- Explore
/sys/class/hwmon:ls /sys/class/hwmon
- Look for the temperature sensor (usually
tempX_input) and fans (pwmX,fanX_input). - Example: CPU temperature might be in
/sys/class/hwmon/hwmon1/temp1_input, and a fan in/sys/class/hwmon/hwmon3/pwm1.
MIT License. См. файл LICENSE.