Created
March 29, 2019 16:44
-
-
Save mansurali901/aab8739f09504df936089fbcc7d9dc5f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
MONGOD=`ps aux |grep mongod |grep -v grep |awk '{print $2}'` | |
MONGOCOUNT=`ps aux |grep mongod |grep -v grep |awk '{print $2}'|wc -l` | |
mail_func () { | |
echo $MONGOD > /tmp/email | |
mail -s "Mongo is not running " [email protected] < /tmp/email | |
} | |
if [ $MONGOCOUNT -eq '1' ]; | |
then | |
echo "[`date`] : Mongo is Running with PID $MONGOD" >> /tmp/mongo.log | |
else | |
echo "[`date`] : Mongo is not running" >> /tmp/mongo.log | |
mail_func | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment