2013-09-17 22:04:50 +02:00
|
|
|
# Ubuntu upstart file at /etc/init/mongod.conf
|
2009-12-14 18:08:40 +01:00
|
|
|
|
2013-11-07 00:25:39 +01:00
|
|
|
# Recommended ulimit values for mongod or mongos
|
|
|
|
# See http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings
|
|
|
|
#
|
|
|
|
limit fsize unlimited unlimited
|
|
|
|
limit cpu unlimited unlimited
|
|
|
|
limit as unlimited unlimited
|
|
|
|
limit nofile 64000 64000
|
|
|
|
limit rss unlimited unlimited
|
|
|
|
limit nproc 32000 32000
|
2010-08-13 16:24:00 +02:00
|
|
|
|
2011-03-17 17:30:24 +01:00
|
|
|
kill timeout 300 # wait 300s between SIGTERM and SIGKILL.
|
|
|
|
|
2009-12-14 18:08:40 +01:00
|
|
|
pre-start script
|
2013-07-11 19:30:54 +02:00
|
|
|
DAEMONUSER=${DAEMONUSER:-mongodb}
|
2014-06-05 16:50:54 +02:00
|
|
|
if [ ! -d /var/lib/mongod ]; then
|
|
|
|
mkdir -p /var/lib/mongodb && chown mongodb:mongodb /var/lib/mongodb
|
|
|
|
fi
|
|
|
|
if [ ! -d /var/log/mongod ]; then
|
|
|
|
mkdir -p /var/log/mongodb && chown mongodb:mongodb /var/log/mongodb
|
|
|
|
fi
|
2013-07-11 19:30:54 +02:00
|
|
|
touch /var/run/mongodb.pid
|
|
|
|
chown $DAEMONUSER /var/run/mongodb.pid
|
2009-12-14 18:08:40 +01:00
|
|
|
end script
|
|
|
|
|
2010-02-12 17:14:29 +01:00
|
|
|
start on runlevel [2345]
|
|
|
|
stop on runlevel [06]
|
2009-12-14 18:08:40 +01:00
|
|
|
|
2010-03-08 20:32:44 +01:00
|
|
|
script
|
2013-09-27 00:06:20 +02:00
|
|
|
ENABLE_MONGOD="yes"
|
2014-03-08 04:04:14 +01:00
|
|
|
CONF=/etc/mongod.conf
|
|
|
|
DAEMON=/usr/bin/mongod
|
|
|
|
DAEMONUSER=${DAEMONUSER:-mongodb}
|
|
|
|
|
2013-09-27 00:06:20 +02:00
|
|
|
if [ -f /etc/default/mongod ]; then . /etc/default/mongod; fi
|
2014-03-08 04:04:14 +01:00
|
|
|
|
|
|
|
# Handle NUMA access to CPUs (SERVER-3574)
|
|
|
|
# This verifies the existence of numactl as well as testing that the command works
|
|
|
|
NUMACTL_ARGS="--interleave=all"
|
|
|
|
if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null
|
|
|
|
then
|
|
|
|
NUMACTL="$(which numactl) -- $NUMACTL_ARGS"
|
|
|
|
DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}
|
|
|
|
else
|
|
|
|
NUMACTL=""
|
|
|
|
DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "x$ENABLE_MONGOD" = "xyes" ]
|
|
|
|
then
|
2014-06-30 17:29:16 +02:00
|
|
|
exec start-stop-daemon --start \
|
|
|
|
--chuid $DAEMONUSER \
|
2013-07-11 19:30:54 +02:00
|
|
|
--pidfile /var/run/mongodb.pid \
|
|
|
|
--make-pidfile \
|
2014-06-30 17:29:16 +02:00
|
|
|
--exec $NUMACTL $DAEMON $DAEMON_OPTS
|
2014-03-08 04:04:14 +01:00
|
|
|
fi
|
2010-03-08 20:32:44 +01:00
|
|
|
end script
|