Skip to content

Instantly share code, notes, and snippets.

@steveneaston
Created October 9, 2015 15:34
Show Gist options
  • Save steveneaston/32631fcd7c37218fbbe7 to your computer and use it in GitHub Desktop.
Save steveneaston/32631fcd7c37218fbbe7 to your computer and use it in GitHub Desktop.
Use Vaprobash to install mongodb if required and restart it if already running
#!/usr/bin/env bash
echo ">>> Installing MongoDB"
mongod --version > /dev/null 2>&1
MONGO_IS_INSTALLED=$?
if [ $MONGO_IS_INSTALLED -eq 0 ]; then
echo ">>> MongoDB already installed"
service mongod restart
else
bash -c "$(curl -fsSL https://raw.githubusercontent.com/steveneaston/Vaprobash/master/scripts/mongodb.sh)" bash $1 $2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment