Created
July 26, 2017 11:24
-
-
Save rummykhan/bd1c88d9284f9cae60ad5b78100abfb0 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 | |
function send_email () { | |
echo sending email; | |
} | |
mongo --eval "db.stats()" > /dev/null # do a simple harmless command of some sort | |
RESULT=$? # returns 0 if mongo eval succeeds | |
if [ $RESULT -ne 0 ]; then | |
send_email | |
`systemctl start mongodb` | |
exit 1 | |
else | |
echo "mongodb running!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment