Mongodb upstart script
Tom
tommedema at gmail.com
Sat Mar 17 11:32:43 UTC 2012
Hi folks,
I'm trying to run mongod as a deamon using upstart under the
unprivileged mongouser account.
The following appears to work great:
# Mongodb Ubuntu upstart file at /etc/init/mongodb.conf
description "MongoDB deamon"
pre-start script
mkdir -p /home/mongouser/data/db
mkdir -p /home/mongouser/data/logs
end script
start on runlevel [2345]
stop on runlevel [06]
exec su -s /bin/sh -c 'exec "$0" "$@"' mongouser --
/home/mongouser/Applications/mongodb/bin/mongod --fork --journal
--nohttpinterface --dbpath /home/mongouser/data/db --logpath
/home/mongouser/data/logs/mongodb.log --logappend --port 30000
------------
When I reboot the system mongod indeed starts properly. However, here
are the issues:
1. when I do sudo status mongodb I get "stop/waiting" even though it is running
2. when I do sudo start mongodb it starts the deamon again, even
though mongod is already running.
Can anyone tell me what is going wrong here?
More information about the upstart-devel
mailing list