title: How to make sure an application keeps running on Linux
body: <p>I'm trying to ensure a script remains running on a development server. It collates stats and provides a web service so it's supposed to persist, yet a few times a day, it dies off for unknown reasons. When we notice we just launch it again, but it's a pain in the rear and some users don't have permission (or the knowhow) to launch it up.</p>
  
  <p>The programmer in me wants to spend a few hours getting to the bottom of the problem but the busy person in me thinks there must be an easy way to detect if an app is not running, and launch it again.</p>
  
  <p>I know I <em>could</em> cron-script ps through grep:</p>
  
  <pre><code>ps -A | grep appname
  </code></pre>
  
  <p>But again, that's another hour of my life wasted on doing something that must already exist... Is there not a pre-made app that I can pass an executable (optionally with arguments) and that will keep a process running indefinitely?</p>
  
  <p>In case it makes any difference, it's Ubuntu.</p>