Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Mongodb upstart file at /etc/init/mongodb.conf
description "Runs mongod server daemon as service."
start on runlevel [2345]
stop on runlevel [06]
respawn limit 10 100
pre-start script
sudo -u mainuser mkdir -p /home/mainuser/data/db
sudo -u mainuser mkdir -p /home/mainuser/data/logs
end script
exec sudo -u mainuser /usr/local/bin/mongod --journal --nohttpinterface --dbpath /home/mainuser/data/db --logpath /home/mainuser/data/logs/mongodb.log --logappend --replSet mainapp --port 30000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment