This script dynamically controls the fans on a Dell R720xd server, prioritizing quiet operation while maintaining optimal cooling. It uses ipmitool
to adjust fan speeds based on workload and temperature.
- Dynamic Fan Speed Adjustment: Automatically adjusts fan speeds based on system temperature.
- Quiet Operation: Starts with a low fan speed and increases only as necessary.
- Failsafe Mechanism: Restores dynamic fan control if an error occurs.
- Configurable: Easily adjust temperature thresholds, fan speeds, and check intervals.
- Detailed Logging: Logs actions, errors, and temperature readings to
/var/log/fan_control.log
.
IPMItool: Ensure ipmitool
is installed:
sudo apt install ipmitool
Root Access: The script requires root privileges to control the server fans.
Save the script to /usr/local/bin/fan_control.sh:
sudo nano /usr/local/bin/fan_control.sh
Paste the script content and save.
sudo chmod +x /usr/local/bin/fan_control.sh
From here you can either start the script manually or automate it to start on boot with a system service:
Create a new service file:
sudo nano /etc/systemd/system/fan_control.service
Paste the following:
ini
Copy code
[Unit]
Description=Dynamic Fan Control Script
After=network.target
[Service]
ExecStart=/usr/local/bin/fan_control.sh
Restart=always
User=root
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
Reload systemd to recognize the new service:
sudo systemctl daemon-reload
sudo systemctl enable fan_control.service
Start the service:
sudo systemctl start fan_control.service
Check the service status:
sudo systemctl status fan_control.service
You can modify these parameters in the script to suit your needs:
TEMP_CHECK_INTERVAL: Time between temperature checks (default: 30 seconds). MIN_FAN_SPEED: Minimum fan speed percentage (default: 20%). MAX_FAN_SPEED: Maximum fan speed percentage (default: 50%). TEMP_THRESHOLDS: Temperature thresholds for fan speed adjustments. FAN_SPEEDS: Fan speeds corresponding to the thresholds. Example To adjust fan speeds more aggressively, modify:
TEMP_THRESHOLDS=(35 45 55 65 75)
FAN_SPEEDS=(20 30 40 50 60)
The script logs all actions, temperature readings, and errors to: /var/log/fan_control.log
tail -f /var/log/fan_control.log
ipmitool Command Fails:
Ensure ipmitool is installed and functional:
ipmitool sdr
Ensure IPMI is enabled in the BIOS/UEFI.
Service Fails to Start:
Check the service logs:
sudo journalctl -u fan_control.service
Fan Speed Fluctuations:
Increase the TEMP_CHECK_INTERVAL or adjust TEMP_THRESHOLDS and FAN_SPEEDS to reduce sensitivity.
This script is released under the MIT License.
- Save the content as
README.md
in your GitHub repository. - Commit and push it to your repository:
git add README.md git commit -m "Added README for Dynamic Fan Control Script" git push