title: wget force retry until there is a connection
body: <p>I have a bash script that uses <code>wget</code> running on a 3g device. I want the script to pause until I get a response so I have setup my code like this: </p>
  
  <pre><code>wget -t 0 -T 15 --retry-connrefused www.example.com
  </code></pre>
  
  <p>The problem is that when there is no connection at all (3g drops for a few seconds) the DNS can't resolve the host and <code>wget</code> stops retrying. </p>
  
  <p>Is there a way to force retry until the connection comes back? I know I can write a loop but I want to know if there is a setting in <code>wget</code> I can use. If there is not what the best variable to build the loop on? </p>
  
  <p><strong>More details:</strong></p>
  
  <p>With the code I wrote, <code>wget</code> will retry but if the device has no Internet connection at all (for example I pull out the 3g dongle from the device) it will stop retrying telling me it can't resolve the host address. It sends that after the 15 seconds defined by <code>-T 15</code></p>
  
  <pre><code>wget: unable to resolve host address
  </code></pre>