I want to start MongoDB (aka mondgod) as a service under FreeBSD. I have the following in rc.conf:


But service mongodb stop (and mongod) give me:

mongod does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable

I need the right startup script for /usr/local/etc/rc.d but I'm a MongoDB newbie. I have searched for a script, including on the MongoDB site, without success. I realize MongoDB on FreeBSD is not optimal, and not popular, but runs well enough for a non-production box. My FreeBSD version is 12.0-RELEASE. MongoDB version is v3.0.15

  • 1
    Is there a file called /usr/local/etc/rc.d/mongod? Probably not, in which case the package is not correctly installed. Use: pkg info to see what packages are installed on the machine. – Richard Smith Feb 7 at 9:52
  • pkg info does not list anything for mongodb. Apparently it was installed form source. Would running pkg add over mongodb installed from source cause problems? – John R. Woodward Feb 10 at 1:14
  • Well, problem partly solved. Mongod doesn't have a freebsd version. The one installed on my machine was installed from source with the linux compatibility layer in place. Since mongodb isn't a freebsd application, it has no script for rc.d and pkg search doesn't have a package for it. I've been Googling for one. Apparently nobody has published such a thing. Bugzilla has a bug with a referance to a /usr/local/etc/rc.d/mongod script but I don't have it. – John R. Woodward Feb 10 at 1:52
  • That version has since been deleted (the original rc.d script is probably this one). You may be able to adapt the rc.d script from the mongodb34 or mongodb36 ports. – Richard Smith Feb 10 at 11:50
  • Adapting this one looks probable. I'l tackle it tomorrow. Thanks. – John R. Woodward Feb 12 at 0:03

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.