※上記の広告は60日以上更新のないWIKIに表示されています。更新することで広告が下部へ移動します。

標準Linuxの/usr/local/sbin/内にある。

スクリプト

~ # cat /usr/local/sbin/Fand
#!/bin/sh

CONF_FILE=/etc/fan.prof
miconapl -a fan_set_speed full

while :
do
        while :
        do
                sleep 60
                TEMP=`miconapl -a temp_get|grep temp=| sed -e "s/.*=//"`
                SPD=`miconapl -a fan_get_speed|grep fan_rpm=|sed -e "s/.*=//"`
                SSPD=`miconapl -a fan_set_speed|grep fan_speed=|sed -e "s/.*=//"`
                if [ -f ${CONF_FILE} ] ; then
                        L_LIMIT=`grep ${SSPD} ${CONF_FILE}| awk '{print $2}'`
                        H_LIMIT=`grep ${SSPD} ${CONF_FILE}| awk '{print $3}'`
                        if [ "${TEMP}" -lt "${L_LIMIT}" ] ; then
                                DIRECT=DOWN
                        elif [ "${TEMP}" -gt "${H_LIMIT}" ] ; then
                                DIRECT=UP
                        else
                                DIRECT=NO
                        fi

                        if [ "${DIRECT}" = "DOWN" -a "${SSPD}" = "slow" ] ; then
                                SSPD_NEW=stop
                        elif [ "${DIRECT}" = "DOWN" -a "${SSPD}" = "fast" -o "${DIRECT}" = "UP" -a "${SSPD}" = "stop" ] ; then
                                SSPD_NEW=slow
                        elif [ "${DIRECT}" = "DOWN" -a "${SSPD}" = "full" -o "${DIRECT}" = "UP" -a "${SSPD}" = "slow" ] ; then
                                SSPD_NEW=fast
                        elif [ "${DIRECT}" = "UP" -a "${SSPD}" = "fast" ] ; then
                                SSPD_NEW=full
                        else
                                SSPD_NEW=${SSPD}
                        fi
                        miconapl -a fan_set_speed ${SSPD_NEW}
                fi

        done
done

~ #