title: Checking network status and controlling PPP in a program
body: <p>So I'm running PPP under linux with a cellular modem.  The program I'm writing needs to know if the link is active before sending any data.</p>
  
  <p>What are my options to check</p>
  
  <ul>
  <li>if the link is available</li>
  <li>if it routes to a server I control (it doesn't go to the internet as I said earlier)</li>
  </ul>
  
  <p>Also, what is the best way to restart it - I'd like to have program control over when it starts and stops, so I assume an init.d isn't appropriate.  Using <code>system()</code> doesn't seem to give a PID, are there other options besides <code>fork()</code> and the gaggle of <code>exec??()</code> calls?</p>
  
  <p>C on Linux on ARM (custom distribution using buildroot).</p>