Mongodb ubuntu - config server and shard together I have the following services on a single shard server:

sudo mongod --dbpath /data/db/ --port 31001
sudo mongod --configsvr --dbpath /data/configdb/ --port 21001

The same server is using for shard and config.
for now I am testing the environment so I am running these rows manually.
I want to run it as a service. I did not event tried it, adding dbpath twice to the config file will not do the work, can you suggest please a config in order to make these lines run as a service?
thanks
An easy way to achieve that is to use cron's @reboot feature:

&gt; crontab -e -u mongodb
@reboot /usr/bin/mongod --configsvr --dbpath /data/configdb/ --port 21001 --logpath /var/log/mongodb/configsvr.log --fork
@reboot /usr/bin/mongod --shardsvr --dbpath /data/db/ --port 31001 --logpath /var/log/mongodb/mongod.log --fork


However, you have to make sure that /etc/security/limits.conf holds the correct values.