DB/MongoDB

mongodb - mongodb.service for systemd

linuxism 2014. 7. 20. 16:47


mongodb.service for systemd

Tested only on Fe­dora 19

File /etc/systemd/system/mongodb.service con­tents:

[Unit]
Description=Mongo is a scalable, document-oriented database.
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/usr/bin/mongod $OPTIONS run
User=mongod
Group=mongod
EnvironmentFile=/etc/sysconfig/mongod
# comment out if dbpath and/or pidfilepath (/etc/mongod.conf)
# are set in /var/*/* (by default)
#NoNewPrivileges=yes
#PIDFile=/var/run/mongod.pid

[Install]
WantedBy=multi-user.target

File /etc/sysconfig/mongod con­tents:

# TODO: add relevant configuration stuff here.
OPTIONS="--quiet -f /etc/mongod.conf"

En­able auto­start

# systemctl enable mongodb



source - https://blog.while.cc/2013/09/30/mongodb-dot-service-for-systemd/