RE: Wolniejsze działanie wieczorami
: 23 gru 11, 19:15
kolego @rufik opublikuj go jeżeli możesz, z pewnością wielu osobom się przyda.
Forum Expertów MultiMediaExpert.pl
https://multimediaexpert.pl/
Ja zastanawiałem się nad takim skryptem, który by działał pod windowsem (modem przez USB).rufik pisze: Wysłałem formularz usterki (korzystam z Sierra 307) do Aero.
A póki co zrobiłem sobie skrypt (w routerze), który sprawdza otrzymany adres IP i robi w razie czego reconnect
Kod: Zaznacz cały
#!/bin/sh
if ! ping -q -c 2 -W 10 8.8.8.8 > /dev/null; then
logger -t tester Restarting USB 3G modem with off-on sequence, no answer to ping
ifdown wan
#disable USB modem
echo 0 > /sys/devices/virtual/gpio/gpio6/value
sleep 2
#enable USB modem
echo 1 > /sys/devices/virtual/gpio/gpio6/value
sleep 10
logger -t tester WAN interface is going up!
ifup wan
sleep 15
fi
#check for proper IP address
ip=`ifconfig | grep -A1 wan | grep addr | awk '{print $2}' | cut -f2 -d ":"`
third=`echo $ip | cut -f3 -d "."`
if [ $third = "108" -o $third = 109 -o $third = 110 -o $third = 111 ]
then
logger -t tester "Got bad IP ($ip), restarting WAN interface..."
ifup wan
fi
Kod: Zaznacz cały
ping -c 30 wp.pl
PING wp.pl (212.77.100.101) 56(84) bytes of data.
64 bytes from www.wp.pl (212.77.100.101): icmp_req=1 ttl=250 time=69.3 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=2 ttl=250 time=67.8 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=3 ttl=250 time=66.7 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=4 ttl=250 time=76.4 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=5 ttl=250 time=64.8 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=6 ttl=250 time=63.7 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=7 ttl=250 time=61.8 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=8 ttl=250 time=69.8 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=9 ttl=250 time=68.9 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=10 ttl=250 time=68.3 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=11 ttl=250 time=67.0 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=12 ttl=250 time=66.2 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=13 ttl=250 time=1314 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=14 ttl=250 time=318 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=15 ttl=250 time=68.0 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=16 ttl=250 time=66.9 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=17 ttl=250 time=65.6 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=18 ttl=250 time=63.7 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=19 ttl=250 time=62.1 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=20 ttl=250 time=70.8 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=21 ttl=250 time=60.0 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=22 ttl=250 time=68.8 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=23 ttl=250 time=68.0 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=24 ttl=250 time=66.8 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=25 ttl=250 time=65.7 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=26 ttl=250 time=64.7 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=27 ttl=250 time=64.1 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=28 ttl=250 time=63.0 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=29 ttl=250 time=60.8 ms
64 bytes from www.wp.pl (212.77.100.101): icmp_req=30 ttl=250 time=70.1 ms
--- wp.pl ping statistics ---
30 packets transmitted, 30 received, 0% packet loss, time 29039ms
rtt min/avg/max/mdev = 60.009/116.476/1314.903/227.094 ms, pipe 2