title: Best method to output log content to listening port
body: <p>I am outputting content of a log via netcat to an application over the network. I don't know if what I'm doing is the most efficient, especially when I notice the netcat session becomes non-responsive. I have to stop netcat and start it again for the application to work again.</p>
  
  <p>The command I run is:</p>
  
  <pre><code>/bin/tail -n1 -f /var/log/custom_output.log | /bin/nc -l -p 5020 --keep-open
  </code></pre>
  
  <p>This needs to run like this 24/7. Is this the most efficient way of doing it? How can I improve on it so I don't have to restart the process daily?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>So I realised that when the log is being rotated, netcat is locked onto a file that's not longer being written to. I can deal with this easily enough.</p>
  
  <p>The question still stands. Is this the best way to do something like this?</p>