Shutting down MongoDB with a command line command, is it possible?
Can I shutdown mongoDB with a command line command?
I use MacOSX but it may be similar as in linux.
If not, does someone know how I can make a script that would enter the mongo shell and shut the server down?
you can send it a termination signal per the document from any unix. you can use ps to find the PID of the mongoDB.
see the following:
Sending a Unix INT or TERM signal
You can cleanly stop mongod using a SIGINT or SIGTERM signal on Unix-like systems. Either ^C, "kill -2 PID," or kill -15 PID will work. Sending a KILL signal kill -9 will probably cause damage if mongod is not running with the --journal option. (In such a scenario, run repairDatabase command.)
After a hard crash, when not using --journal, MongoDB will say it was not shutdown cleanly, and ask you to do a repair of the database.
http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo#StartingandStoppingMongo-Stoppingmongod
alternatively you can install tcl and use its expect script to send command to mongoDB shell (or any other interative program actually).