PingDirectory

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 <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

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 the port value both on the command line and in the properties file, the command-line value takes priority. The command uses the bindDN and bindPassword 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=*)"