# Ubuntu upstart file at /etc/init/mongod.conf

# 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

kill timeout 300 # wait 300s between SIGTERM and SIGKILL.

pre-start script
  DAEMONUSER=${DAEMONUSER:-mongodb}
  touch /var/run/mongos1.pid
  chown $DAEMONUSER /var/run/mongos1.pid
end script

start on runlevel [2345]
stop on runlevel [06]

script
  CONFIG=" config/127.0.0.1:28001,127.0.0.1:28002,127.0.0.1:28003"
  DAEMON=/usr/bin/mongos
  DAEMONUSER=${DAEMONUSER:-mongodb}

  start-stop-daemon --start \
        --chuid $DAEMONUSER \
        --pidfile /var/run/mongos1.pid \
        --make-pidfile \
        --exec $DAEMON -- --configdb $CONFIG --port 27017  --logpath  /var/log/mongodb/mongos1.log
  
end script
