Tesy

Wi-Fi restarter

Feb 16th, 2014
80
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. # Which address do you want to ping to see if you can connect
  4. pingip='192.168.1.1'
  5.  
  6. # Perform the network check and reset if necessary
  7. /bin/ping -c 2 -I wlan0 $pingip > /dev/null 2> /dev/null
  8. if [ $? -ge 1 ] ; then
  9.     echo "Network is DOWN."
  10.     /sbin/ifdown wlan0
  11.     sleep 5
  12.     /sbin/ifup --force wlan0
  13. else
  14.     echo "Network is UP."  
  15. fi
RAW Paste Data