#!/bin/bash router="192.168.1.3" interface="wlan0" ping -w 30 -c 1 ${router} > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "Restart ${interface}" ifdown ${interface} ifup ${interface} fi