here is my code if some one need it in future (saved under /usr/bin/wifi_rebooter.sh):
#!/bin/ash
SERVER=8.8.8.8
ping -c2 ${SERVER} > /dev/null
if [ $? -ne 0 ]
then
echo "Offline"
ifconfig wlan-sta down
sleep 25
ifconfig wlan-sta up
else
echo "Online"
fi
then make it executable:
chmod +x /usr/bin/wifi_rebooter.sh
Now set a cron in http://192.168.8.1/cgi-bin/luci/ under System β Scheduled Tasks i added this line to check every 2min if internet connection exists if not restart wifi client: