View Single Post
Posts: 79 | Thanked: 332 times | Joined on Jul 2011
#86
Maybe it is much better to check the 'pidof' only once a time, so like this one:

Last, it would be better to set the "LAST" variable when it really changed, so put it in the [ $NOW != $LAST ] statement.

Code:
#!/bin/sh

let LAST=2
while true; do

    if [ $(pidof telepathy-stream-engine) ]; then
            let NOW=1
        else
            let NOW=0
    fi
    
    if [ $NOW != $LAST ]; then

        if  [ $NOW -eq 0 ]; then
            sh /bin/speedadaptnormal > /dev/null
        else
            sh /bin/speedadaptfix > /dev/null
        fi

        let LAST=NOW

    fi

    sleep 5
done

Last edited by VaZso; 2011-07-07 at 13:12.