Evaluation of command-line options and file options
You can specify options for a command-line tool on the command line, in a properties file, or both.
Options you specify on a tool’s command line take priority over options in a properties file.
Consider the following scenarios.
Command-line options | Server uses … |
---|---|
No command-line options |
The options in the default |
Command-line options other than the |
The command-line options, which take priority if the options are also in the The file options for options that are only in the default |
Only the |
The options in |
The |
The command-line options, which take priority if the options are also in The file options for options that are only in |
The |
Only the options you specify on the command line, ignoring the default properties file. |
Example
Consider this example properties file that is saved as <server-root>/bin/tools.properties
:
hostname=server1.example.com port=1389 bindDN=cn=Directory\ Manager bindPassword=secret
The server checks command-line options and file options to determine the options to use, as explained below.
-
All options presented with the tool on the command line take precedence over any options in a properties file.
In the following example, the command runs with the options specified on the command line (
--port
and--baseDN
). With theport
value both on the command line and in the properties file, the command-line value takes priority. The command uses thebindDN
andbindPassword
values specified in the properties file.$ bin/ldapsearch --port 2389 --baseDN ou=People,dc=example,dc=com \ --propertiesFilePath bin/tools.properties “(objectclass=*)”
-
If you specify the properties file using the
--propertiesFilePath
option and no other command-line options, the server uses only the options in the specified properties file:$ bin/ldapsearch --propertiesFilePath bin/tools.properties \ “(objectclass=*)”
-
If you do not specify any command-line options, the server attempts to locate the default properties file in the following location:
<server-root>/config/tools.properties
By moving your
tools.properties
file from<server-root>/bin
to<server-root>/config
, you do not have to specify the--propertiesFilePath
option. That change shortens the previous command to the following command:$ bin/ldapsearch "(objectclass=*)"