I have a shell script to do some mongo db actions:
e.g. mongo testdb --eval \"db.dropDatabase()\"
BUT, if the mongod server is not running, I get:>
this is what i run to check if mongod is up:
# this script checks if the mongod is running.
# if not, send mail
#
EMAILIST=dba@wherever
`ps -A | grep -q '[m]ongod'`
if [ "$?" -eq "0" ]; then
exit 0
else
echo "The mongod server SB2MDB01 is DOWN" | mailx \
-s "Server DOWN: SB2MDB01" $EMAILIST
fi
exit 0