Is this the correct format for starting a service in linux with command line arguments?

Posted on

Problem :

This seems like such a silly question, but I can’t seem to find the answer.

Usually I start mongo via

service mongodb start

But I need to increase the namespace size…
So I have done this:

service mongodb start --nssize 1000000000

Is this the correct syntax?
I can’t find a way for mongo to output the nssize it is using, nor can I find any way to determine the argument is being properly handled…

Solution :

No, ‘service’ and other ‘/etc/init.d/’ service management commands usually don’t accept application-specific parameters.

You have to configure your app using its own config file (usually in /etc/yourapp_name).
For Mongodb it should be /etc/mongodb.conf (check this link and search for nssize)

But sometimes the parameter you want to change cannot be modified using a configuration file. It’s the case if it’s a command-line argument. You then have to look how to pass additional command options, usually inside /etc/sysconfig/your_app_name

Initscripts don’t take arguments that way. You will need to edit the initscript itself in /etc/init.d or see if it (like all good initscripts) has an associated configuration file in /etc/sysconfig.

Leave a Reply

Your email address will not be published. Required fields are marked *