as i am working on my tmux/bash skills, i created a very
simple script,
to display these current values on the tmux status bar, once per second
- temperature
- speed
- state
and scripts to change the fan speed.
— fan.stop.sh | stop the fan |
---|---|
— fan.max.sh | set fan to max speed |
— fan.custom.sh | set fan to custom speed, valid values from 0 to 255 |
and stress.sh
to max out the the cpu, which will raise the cpu temp
in .tmux.conf
set -g status-interval 1
set -g status-right "#(~/scripts/temp/fan.stats.sh)"
and for ~/scripts/temp/fan.stats.sh
#!/bin/sh
temp=`cat /sys/class/thermal/thermal_zone0/temp`
speed=`gl_fan -s`
state=`cat /sys/class/thermal/cooling_device0/cur_state`
printf "temp:$temp speed:$speed state:$state"
and four .sh scripts:
— fan.stop.sh
#!/bin/sh
echo 0 > /sys/class/thermal/cooling_device0/cur_state
cat /sys/class/thermal/cooling_device0/cur_state
— fan.max.sh
#!/bin/sh
echo 255 > /sys/class/thermal/cooling_device0/cur_state
cat /sys/class/thermal/cooling_device0/cur_state
— fan.custom.sh
#!/bin/sh
echo $1 > /sys/class/thermal/cooling_device0/cur_state
cat /sys/class/thermal/cooling_device0/cur_state
stress.sh
#!/bin/sh
stress-ng --matrix 0 -t 5m