Sleeping for 2 minutes is not a good solution. As tinkster said, you need to figure out why it takes so long to connect.
As a temporary "solution", you can use a loop to test the connection rather than just sleeping:
while true; do
ping -c1
www.linux.org > /dev/null 2>&1
if [[ $? == 0 ]]; then
break
fi
sleep 5
done
This will try pinging
www.linux.org every five seconds until it succeeds (a packet is received).
But, really, it shouldn't take 2 minutes to connect. Something is wrong there.