I have a shell script to do some mongo db actions:
e.g. mongo testdb --eval \"db.dropDatabase()\"
mongo testdb --eval \"db.dropDatabase()\"
BUT, if the mongod server is not running, I get:>
try running this in your shell script:-
pgrep mongod
If the value is numeric you know that the process is running, if you get an empty value, flag it as service not running...