Skip to content

Instantly share code, notes, and snippets.

@obihann
Last active August 29, 2015 14:01
Show Gist options
  • Save obihann/8a50d4c6aa904741aad8 to your computer and use it in GitHub Desktop.
Save obihann/8a50d4c6aa904741aad8 to your computer and use it in GitHub Desktop.
CleanMongo

#CleanMongo

In short I ran into a lot of trouble with MongoDB not closing cleaning in my Vagrant server, so I made this little script to stop the instance, clean it, then restart.

Built for debian based systems, or anything that uses service to handle /etc/init.d scripts.

#!/bin/sh
service mongod stop
rm /var/lib/mongodb/mongod.lock
mongod --repair
service mongod start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment