Hello everyone,
i need to disconnect sometimes from WiFi Client and reconnect it again if internet doesnt works anymore.
I write a script on my raspberry pi but it doesnt works on my GL-AR750S.
it checks via cron every minute the ping if internet is down then it disconnect and connect wifi again.
here is the code:
#!/bin/bash
The IP for the server you wish to ping (8.8.8.8 is a public Google DNS server)
SERVER=8.8.8.8
Only send two pings, sending output to /dev/null
ping -c2 ${SERVER} > /dev/null
If the return code from ping ($?) is not 0 (meaning there was an error)
if [ $? != 0 ]
then
# Restart the wireless interface
ifconfig wlan0 down
sleep 15
ifconfig wlan0 up
fi
what i do wrong?