Linux – Ubuntu/Linux: how are startup parameters typically defined for startup scripts (sysvinit)

init.dlinuxstartup

I'm curious as to what's the standard method of telling a startup script to execute with certain parameters.

For instance with MySQL, there's my.cnf, and from what I can tell, the startup parameters are derived by configuration options specified in my.cnf (i.e. --bind-address=127.0.0.1 corresponds to bind-address option in the my.cnf file and so on).

I always assumed that every daemon/service would have a configuration file in /etc/<some_app> and that these startup options are determined with it. However, I've ran into several daemon/services that I can't find where/how it determines what parameters to startup with. /etc/init.d/<some_script> usually has several conditionals and the usual defaults, but I'm not sure where these startup options are actually determined. Couple of examples are pure-ftpd and mediatomb; can't tell from the init.d script how the parameters are defined: the former has a conf/ sub-directory with files representing startup options (these seem to be a Debian/Ubuntu specific configuration method as the apt package installs the pure-ftpd-wrapper which references these conf files). With mediatomb, there's just a config.xml file.

I guess the question could be phrased as, "if you're looking to change startup options for a typical package-installed daemon/service application on a Debian-like system, where should you look?"

Best Answer

For many services you would look in /etc/default/{service} a script fragment that allows you to insert/modify command line options for services that can't be configured by just modifying a configuration file.

This pattern is not followed by every service though. Sometimes you have to edit the /etc/init.d/{service} file directly.

One quick thing is to do a grep source for the /etc/init.d/{service} you are curious about. Most start scripts are using the dash or bash. The start up scripts frequently load the configuration from /etc/default/{service} or elsewhere by having a command like source /etc/default/{service} towards the top of the startup script.