Adam Fields (work stuff) RSS

This is my blog about work stuff.

See this post for discussion of what this blog is about and what I do.

I am often available for consulting work, and always happy to discuss it even if I'm currently very busy. Email me or find me on twitter @fields if you need something.

Archive

Mar
1st
2010
Mon
permalink

Auto-starting mongodb at boot time on OSX

This really goes for starting any daemon at boot, but here’s a specific example for mongodb. Make a file and call it something like “org.mongodb.start.plist”:


<plist version="1.0">
<dict>
    <key>Label</key>
    <string>org.mongodb.start</string>
    <key>ProgramArguments</key>
    <array>
        <string>/path/to/mongodb/bin/mongod</string>
        <string>-f</string>
        <string>/etc/mongodb.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true></true>
    <key>UserName</key>
    <string>fields</string>
</dict>
</plist>

Put that file in /Library/LaunchDaemons, and chmod/chown it:

sudo chown root:wheel /Library/LaunchDaemons/org.mongodb.start.plist
sudo chmod 644 /Library/LaunchDaemons/org.mongodb.start.plist

It should then start at boot time. Use the launchctl command line to see what went wrong utility if it doesn’t run.

launchctl list | grep mongo
launchctl help
Comments (View)

blog comments powered by Disqus