Created
August 29, 2016 14:44
-
-
Save porn/6ed41962c45135e7fe4f6d8cb67fcbc8 to your computer and use it in GitHub Desktop.
script for forcing initial resync of mongo secondary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this script is intended for forcing initial resync of mongo secondary | |
read -p "This will DELETE ALL data on the machine! If you wish to continue then type: 'sure'> " | |
if [[ ! $REPLY == 'sure' ]] | |
then | |
echo "Okay, bye!" | |
exit 1 | |
fi | |
echo | |
echo "* Stopping mongo service" | |
sudo service mongod stop | |
sleep 3 | |
echo "* Deleting the content of /var/lib/mongodb/" | |
rm -rf /var/lib/mongodb/* | |
echo "* Starting mongo service" | |
sudo service mongod start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment