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 | Directory Server uses ... |
---|---|
No command-line options | The options in the default <server-root>/config/tools.properties file |
Command-line options other than the --propertiesFilePath
<my-properties-file> option |
The command-line options, which take priority if the options are also in the <server-root>/config/tools.properties file The file options for options that are only in the default <server-root>/config/tools.properties file |
Only the --propertiesFilePath
<my-properties-file> option |
The options in <my-properties-file> |
The --propertiesFilePath
<my-properties-file> option and other
command-line options |
The command-line options, which take priority if the options are also in <my-properties-file> The file options for options that are only in <my-properties-file> |
The --noPropertiesFile option and other command-line
options |
Only the options you specify on the command line, ignoring the default properties file |
Example
hostname=server1.example.com
port=1389
bindDN=cn=Directory\ Manager
bindPassword=secret
Directory 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, Directory Server uses only the
options in the specified properties
file:
$ bin/ldapsearch --propertiesFilePath bin/tools.properties \ “(objectclass=*)”
- If do not specify any command-line options, Directory 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=*)"