Created
June 20, 2020 19:00
-
-
Save 4sskick/d600f7988e1ca64b01cb055de750b199 to your computer and use it in GitHub Desktop.
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 | |
mongo --eval "db.stats()" # do a simple harmless command of some sort | |
RESULT=$? # returns 0 if mongo eval succeeds | |
if [ $RESULT -ne 0 ]; then | |
echo "MongoDB service is not running, try to run with admin" | |
sleep 3 #3 secs | |
exit 1 | |
else | |
echo "MongoDB service is running!" | |
sleep 3 #3 secs | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment