added a loop that waits for internet connectivity before proceeding with the rest of the script. this is needed if rc.local executes this before internet connectivity is achieved