Skip to content

Instantly share code, notes, and snippets.

@joar
Created November 13, 2011 19:20
Show Gist options
  • Save joar/1362530 to your computer and use it in GitHub Desktop.
Save joar/1362530 to your computer and use it in GitHub Desktop.
MongoDB repair - Recover from faulty MongoDB shutdown
#!/usr/bin/env bash
# MongoDB repair - Recover from faulty MongoDB shutdown
# By Joar Wandborg <http://wandborg.se>
#
# Tested on Ubuntu Oneiric 11.10
sudo rm /var/lib/mongodb/mongod.lock
sudo mongod --repair
sudo service mongodb start
sleep 1
sudo service mongodb status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment