Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run MongoDB server as a service (detached from terminal)?

When I start the MongoDB server (mongod) from terminal it keeps that tab open. How do I go about running it as a service?

I'm on OSX Lion.

I like how the rails server script has a -d option to detach it from terminal.

like image 303
tybro0103 Avatar asked Aug 10 '11 19:08

tybro0103


People also ask

How do I start MongoDB from terminal?

To start MongoDB, run mongod.exe from the Command Prompt navigate to your MongoDB Bin folder and run mongod command, it will start MongoDB main process and The waiting for connections message in the console.

What is the command to run MongoDB server?

Open up your command prompt and type mongod to start the MongoDB server.


1 Answers

This is built into mongod, much like it is in the rails server. Instead of -d you'll need to use --fork and you'll probably want to specify --logpath /path-to/logfile --logappend as well, so that your output will be logged and will keep any previous logs.

See the docs on starting and stopping Mongo for more information.

like image 75
Emily Avatar answered Sep 21 '22 12:09

Emily