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.