Skip to content

Instantly share code, notes, and snippets.

@tommedema
Created May 30, 2012 17:19
Show Gist options
  • Save tommedema/2837747 to your computer and use it in GitHub Desktop.
Save tommedema/2837747 to your computer and use it in GitHub Desktop.
# Mongodb upstart file at /etc/init/mongodb.conf
description "Runs mongod server daemon as service."
start on runlevel [2345]
stop on runlevel [06]
respawn
respawn limit 10 100
limit nofile 20000 20000
kill timeout 300 # wait 300s between SIGTERM and SIGKILL.
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 webapp --port 30000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment