Skip to content

Instantly share code, notes, and snippets.

@Genda1ph
Forked from jwilm/mongodb.service
Last active April 25, 2018 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Genda1ph/2d0ef5b209ed1bd9b568977468202654 to your computer and use it in GitHub Desktop.
Save Genda1ph/2d0ef5b209ed1bd9b568977468202654 to your computer and use it in GitHub Desktop.
MongoDB systemd service unit configuration
[Unit]
Description=MongoDB Database Service
Wants=network.target
After=network.target
[Service]
Type=simple
PermissionsStartOnly=true
ExecStartPre=/bin/mkdir -p /var/lib/mongodb
ExecStartPre=/bin/chown mongodb:mongodb /var/lib/mongodb
ExecStart=/usr/bin/mongod --config /etc/mongod.conf
ExecReload=/bin/kill -HUP $MAINPID
Restart=always
User=mongodb
Group=mongodb
[Install]
WantedBy=multi-user.target
@Genda1ph
Copy link
Author

Genda1ph commented Nov 7, 2017

This systemd config requires you to specify empty processManagement and systemLog blocks in your config, these aspects are managed by systemd and journald in this case.

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