1

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

mongod_enable="YES"
mongod_config="/usr/local/etc/mongodb.conf"
mongod_dpath="/var/db/mongod"

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 07 '19 at 09: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 '19 at 01: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 '19 at 01:52
  • That version has since been deleted (the original rc.d script is probably [this one](https://svnweb.freebsd.org/ports/head/databases/mongodb/files/mongod.in?revision=415311&view=markup&pathrev=477220)). You may be able to adapt the rc.d script from the mongodb34 or mongodb36 ports. – Richard Smith Feb 10 '19 at 11:50
  • Adapting this one looks probable. I'l tackle it tomorrow. Thanks. – John R. Woodward Feb 12 '19 at 00:03
  • It worked with just a few changes. Thanks. – John R. Woodward Feb 20 '19 at 03:30

0 Answers0