Skip to content

Instantly share code, notes, and snippets.

@httpsterio
Created June 6, 2015 18:46
Show Gist options
  • Save httpsterio/fbe03817c318d679ce4a to your computer and use it in GitHub Desktop.
Save httpsterio/fbe03817c318d679ce4a to your computer and use it in GitHub Desktop.
#!/bin/bash
# change the ip to your default gateway
ping -c4 192.168.1.1 > /dev/null
#if no ping exits unsuccesfully
if [ $? != 0 ]
then
echo "No connection, restarting wlan0"
#restarting wlan
/sbin/ifdown 'wlan0'
sleep 10
/sbin/ifup --force 'wlan0'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment