环境:我家云 (Debian Buster with Armbian Linux 5.3.0-rockchip64)

失败的方法:

在我的设备上实测不生效,手动改了也自动秒恢复,实际上就是存在某些问题压根改不了。
查看风扇状态:cat /sys/class/thermal/cooling_device0/cur_state
启用风扇; echo 1 > /sys/class/thermal/cooling_device0/cur_state
关闭风扇: echo 0 > /sys/class/thermal/cooling_device0/cur_state

成功方案

参考了:恩山论坛原贴

#!/bin/bash
#甜糖监控进程存在&自动唤起&日志记录脚本
d=`date '+%F %T'`;
num=`ps fax | grep '/ttnode' | egrep -v 'grep|echo|rpm|moni|guard' | wc -l`;
echo $num;
if [ $num -lt 1 ];then
 echo "[$d] ttnode is dead...restarting" >> /usr/ttnode/log.log ;
 echo "[$d] ttnode is dead...restarting";
 mount -o,remount,rw /dev/sda1 /mnts
 /usr/ttnode/ttnode_172 -p /mnts;
fi

#温控风扇(大于40度开转小于45度停止)每次开转前有反复启停转动三次作为提示。

if [ -n "$1" ]; then
max=$1
else
max=45000
fi
if [ -n "$2" ]; then
min=$2
else
min=40000
fi
echo $max, $min
#(只是为了方便关闭调试的时候打开的东西才多了这句) echo 70 > /sys/class/gpio/unexport 
echo 70 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio70/direction
i=0
for j in 1 2 3 4 5 6
do
echo $i > /sys/class/gpio/gpio70/value
i=$(( 1 - $i ))
sleep 2
done
while true
do
t=`/bin/cat /sys/class/thermal/thermal_zone0/temp`
if [ $t -gt $max ]; then
  echo 1 > /sys/class/gpio/gpio70/value
  echo "$t > $max"
fi
if [ $t -lt $min ]; then
  echo 0 > /sys/class/gpio/gpio70/value
  echo "$t < $min"
fi
sleep 10
done
echo 70 > /sys/class/gpio/unexport

标签: none

添加新评论