Skip to content

Instantly share code, notes, and snippets.

@romuloctba
Forked from benileo/mongod.service
Created May 31, 2016 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save romuloctba/2ce035df5520af57cf9a4e0c7c73658c to your computer and use it in GitHub Desktop.
Save romuloctba/2ce035df5520af57cf9a4e0c7c73658c to your computer and use it in GitHub Desktop.
Systemd Service Script for Mongod On Ubuntu 15.04+
[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
@romuloctba
Copy link
Author

File path needs to be /lib/systemd/system/mongod.service

$ systemctl enable mongod.service
$ systemctl start mongod.service

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