|
发表于 2020-1-4 17:49:28
|
显示全部楼层
本帖最后由 ldir 于 2021-5-13 08:54 编辑
- temp1=`/sbin/getsysinfo hdtmp 1 | awk -F " " '{print $1}'`
- temp2=`/sbin/getsysinfo hdtmp 2 | awk -F " " '{print $1}'`
- open=40
- close=32
- if [[ $temp1 -ge $open ]] || [[ $temp2 -ge $open ]]
- then
- echo 1 > /sys/class/gpio/gpio42/value
- echo `date +'%Y-%m-%d %H:%M'` '硬盘温度HDD1:'$temp1'℃ ,HDD2:'$temp2'℃,启动风扇' >> /var/log/fan.log
- else
- if [[ $temp1 -le $close ]] || [[ $temp2 -le $close ]]
- then
- echo 0 > /sys/class/gpio/gpio42/value
- echo `date +'%Y-%m-%d %H:%M'` '硬盘温度HDD1:'$temp1'℃ ,HDD2:'$temp2'℃,关闭风扇' >> /var/log/fan.log
- else
- echo `date +'%Y-%m-%d %H:%M'` '硬盘温度HDD1:'$temp1'℃ ,HDD2:'$temp2'℃' >> /var/log/fan.log
- fi
- fi
- exit
复制代码
|
|