Skip to content

Instantly share code, notes, and snippets.

@benileo
Last active March 1, 2021 04:57
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save benileo/ada486d73f58dd93a0ee to your computer and use it in GitHub Desktop.
Save benileo/ada486d73f58dd93a0ee to your computer and use it in GitHub Desktop.
Systemd Service Script for Mongod On Ubuntu 15.04, 15.10, 16.04 Xenial
[Unit]
Description=High-performance, schema-free document-oriented database
Documentation=man:mongod(1)
After=network.target
[Service]
Type=forking
User=mongodb
Group=mongodb
RuntimeDirectory=mongod
PIDFile=/var/run/mongod/mongod.pid
ExecStart=/usr/bin/mongod -f /etc/mongod.conf --pidfilepath /var/run/mongod/mongod.pid --fork
TimeoutStopSec=5
KillMode=mixed
[Install]
WantedBy=multi-user.target
@marksmeets
Copy link

if your data is on an nfs mounted directory, use
After=nfs-client.target

@ruixiangTan
Copy link

thanks, man. you just saved my day!

@benileo
Copy link
Author

benileo commented Jun 4, 2016

You are all very welcome! I find it astonishing that @mongodb still does not have support for Ubuntu 14.04+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment