Hirdetés

Új hozzászólás Aktív témák

  • SteveBeard

    senior tag

    válasz suste #12332 üzenetére

    Szia!

    Az a baj, hogy szerintem a modemmel van baj, tehát a network restart nem segít, mert nem áramtalanítja a modemet.

    Ezt találtam egyszer már segített, de nem tudom, hogy kell-e nekem az egész, valamint elég sokáig tartott az újraindulás.

    #!/bin/sh

    # save dog.sh in /root/dog.sh.
    # You can use winscp with scp protocol to do this.
    # Using ssh set executation permission and replace the crontab:
    # chmod +x /root/dog.sh
    # echo "* * * * * /root/dog.sh" | crontab -

    # fix wpad / wpad-mini / hostapd stop working bug
    logread -l 100 | grep -n "IEEE 802.11: did not acknowledge authentication response"
    if [ $? -eq 0 ]; then
    /etc/init.d/network restart
    fi

    # fix kernel bug
    n=0
    while [ 1 ]; do
    #ping with timeout 10 seconds
    ping -c 1 -W 10 -w 10 8.8.8.8
    ret=$?

    echo ping result $ret
    if [ $ret -eq 0 ]; then
    echo ping ok
    exit 0
    else
    echo ping fail
    n=$((n+1))
    # when wan-dhcp fail,
    # net is unreachable and ping return without any delay
    # using sleep 1 avoid fail count overflow too fast
    sleep 1
    fi

    echo fail counter $n
    if [ $n -gt 60 ]; then
    # in case of wan-dhcp fail total time to reboot is 1 min (60 seconds)
    # in case of ping-timeout total time to reboot is 11 min (660 seconds)
    reboot
    fi
    done

    ping ok 2017.11.15 22:50
    ping result 0
    ping ok 2017.11.15 22:51
    ping result 1
    ping fail 2017.11.15 22:52
    fail counter 1 2017.11.15 22:52
    ping result 1
    ping fail 2017.11.15 22:52
    fail counter 2 2017.11.15 22:52
    ping result 1
    ping fail 2017.11.15 22:52
    fail counter 3 2017.11.15 22:52
    ping result 0
    ping ok 2017.11.15 22:52
    ping result 1
    ping fail 2017.11.15 22:53
    fail counter 1 2017.11.15 22:53
    ping result 1
    ping fail 2017.11.15 22:53
    .
    .
    .
    .
    .

    fail counter 7 2017.11.15 22:53
    ping result 1
    ping fail 2017.11.15 22:53
    fail counter 8 2017.11.15 22:53
    ping result 1
    ping fail 2017.11.15 22:53
    fail counter 9 2017.11.15 22:53
    ping result 1
    ping fail 2017.11.15 22:53
    fail counter 10 2017.11.15 22:53
    ping result 1
    ping fail 2017.11.15 22:53
    fail counter 11 2017.11.15 22:53
    ping result 1
    ping fail 2017.11.15 22:53
    fail counter 12 2017.11.15 22:53
    ping result 1
    ping fail 2017.11.15 22:53
    fail counter 13 2017.11.15 22:53
    ping result 0
    ping ok 2017.11.15 22:53
    ping result 0
    ping ok 2017.11.15 23:06
    ping result 0

    Steve

Új hozzászólás Aktív témák