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

30,643

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.

Share:
30,643
tybro0103
Author by

tybro0103

Coffee junkie, computer nerd, fitness monster, and father of two cool dudes.

Updated on May 07, 2020

Comments

  • tybro0103
    tybro0103 almost 4 years

    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.