1. If the return code from ping ($?) is not 0 (meaning there was an error)

if [ $? != 0 ] then

  1. Restart the wireless interface

ifdown --force ${WLANINTERFACE} ifup ${WLANINTERFACE} fi </syntaxhighlight>

  1. Make file executable by running the command
    chmod +x /root/wifi_autoconnect.sh
    
  2. Schedule the script to run every minute. For this:
    1. Install cron:
      apt-get install cron
      
    2. In the end of the/etc/crontab file add line
      *  *	* * *	root	/root/wifi_autoconnect.sh
      # be sure to add an empty line at the end of the file