title: Restart MongoDB after crash
body: <p>I ran MongoDB in background in the Ubuntu server with the following command :</p>
  
  <pre><code>mongod --fork --logpath /var/log/mongod.log
  </code></pre>
  
  <p>But sometimes database crashes and I have to restart manually, my question is how to restart automatically if database crashes ?</p>
  
  <p>I have tried to add in <code>/etc/init/mongodb.conf</code>:</p>
  
  <pre><code>respawn
  respawn limit 10 90
  </code></pre>
  
  <p>But still if I kill monogodb process it haven't started automatically. What is the problem ?</p>
  
  <p>Thanks</p>