Mongo - kill -SIGTERM

Hi Everyone, would anyone confirm if the command = kill -SIGTERM $(pgrep mongo) is correct to send a SIGTERM to Mongo Process?

I would use pkill -SIGTERM -f mongod

That’s why pkill exists! But also your grep could match all sorts of things.

You may also want to just double-check whether there are any differences between a SIGTERM and a more high-level db.shutdownServer() if that’s what you’re wanting to do as there may well be naunced differences when it comes to things like replication etc.

e.g., https://www.mongodb.com/docs/manual/reference/method/db.shutdownServer/