DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2012-04-07 13:12:08

noxunas
Member
Registered: 2011-03-03
Posts: 30

HELP with my fancontrol script

Hy everybody,

i have a problem with the script on lines 46, 53 et 60: if [ $(system_temp)......
at the execution :
=> "[: too many arguments"

---------------------
#!/ffp/bin/sh

# PROVIDE: fancontrol
# REQUIRE: LOGIN

. /ffp/etc/ffp.subr

name="fancontrol"
start_cmd="fancontrol_start"
stop_cmd="fancontrol_stop"
status_cmd="fancontrol_status"

PERIOD=20
LOGFILE=/var/log/fan.log
SysHigh=60
SysLow=54
SysStop=50
HddHigh=60
HddLow=54
HddStop=50

disk1_temp()
    {
    smartctl -d marvell --all /dev/sda |grep 194 | tail -c 14| head -c 2
    }

disk2_temp()
    {
    smartctl -d marvell --all /dev/sdb |grep 194 | tail -c 14| head -c 2
    }
   
system_temp()
    {
    FT_testing -T | tail -c 3 | head -c 2
    }
Fancontrol() {
#!/bin/sh

echo "Starting DNS-320 Fancontrol script"
echo "Current temperatures: Sys: `system_temp`°C, HDD1: `disk1_temp`°C, HDD2: `disk2_temp`.C"

FAN=`fanspeed g`

while /ffp/bin/true; do
        /bin/sleep $PERIOD
        if [ $(system_temp) -ge "$SysHigh" -o $(disk1_temp) -ge "$HddHigh" -o $(disk2_temp) -ge "$HddHigh" ]; then
if [ "$FAN" != "high" ]; then
                echo "Running fan on high, temperature too high: Sys: `system_temp`°C, HDD1: `disk1_temp`°C, HDD2: `disk2_temp`.C "
                fanspeed h
                FAN=high
            fi
        else
            if [ $(system_temp) -ge "$SysLow" -o $(disk1_temp) -ge "$HddLow" -o $(disk2_temp) -ge "$HddLow" ]; then
      if [ "$FAN" != "low" ]; then
                    echo "Running fan on low, temperature high: Sys: `system_temp`°C, HDD1: `disk1_temp`°C, HDD2: `disk2_temp`.C "
                    fanspeed l
                    FAN=low
                fi
            else
                if [ $(system_temp) -le "$SysStop" -a $(disk1_temp) -le "$HddStop" -a $(disk2_temp) -le "$HddStop" ]; then
      if [ "$FAN" != "stop" ]; then
                        echo "Stopping fan, temperature low: Sys: `system_temp`°C, HDD1: `disk1_temp`°C, HDD2: `disk2_temp`.C "
                        fanspeed s
                        FAN=stop
                    fi
                fi
            fi
        fi
    done
}
   
fancontrol_start() {
    if [ ! -e /var/run/fancontrol.pid ] ; then
        killall fan_control >/dev/null 2>/dev/null &
        Fancontrol &
        echo $! >> /var/run/fancontrol.pid
    else
        echo "Fancontrol daemon already running"
    fi
}

fancontrol_stop() {
    echo "Stopping DNS-320 Fancontrol daemon"
    kill -9 `cat /var/run/fancontrol.pid`
    rm /var/run/fancontrol.pid
}
   
fancontrol_restart() {
    fancontrol_stop
    fancontrol_start
}

fancontrol_status() {
    if [ -e /var/run/fancontrol.pid ]; then
        echo "Fancontrol daemon is running"
    else
        echo "Fancontrol daemon is not running"
    fi
}
run_rc_command "$1"
------------------------------------------


Thanks for your help !

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB