How To
ForgeRock Identity Platform
Does not apply to Identity Cloud

How do I run the command-line interface in IDM (All versions) if my install and project directories are different?

Last updated Apr 8, 2021

The purpose of this article is to provide information on running the command-line interface (cli.sh) in IDM when your install and project directories are different; this means the boot.properties file is in a different location to the one expected by the command-line utilities. This information applies to Unix® and Linux® systems.


Background information

By default, the command-line utilities run with the properties defined in your project's boot.properties file (located in /path/to/idm/resolver/ (IDM 6 and later) or /path/to/idm/conf/boot/ (IDM 5.x)). This means you will encounter the following error if you have installed IDM in one directory (for example, /opt/openidm) but run IDM with the project directory (-p switch) set to a different directory (for example, /etc/openidm):

/opt/openidm$ ./cli.sh Executing ./cli.sh...  Starting shell in /opt/openidm  No boot properties file detected at /opt/openidm/resolver/boot.properties

To overcome this issue, you must set system variables in the cli.sh script to point to your project directory.

Setting system variables (IDM 6 and later)

You can either edit your cli.sh script to make the changes permanent or specify the IDM_ENVCONFIG_DIRS environment variable when you run the script. You should not specify JAVA_OPTS when running the script because of the following known issue: OPENIDM-12316 (cli.sh fails with NullPointerException when it's started with -Didm.envconfig.dirs at command line).

The following examples demonstrate this, where:

  • The project directory is /etc/idm
  • The boot.properties file is located in /etc/idm/altresolver

Edit the cli.sh script

You should update the cli.sh script by setting the idm.envconfig.dirs property to the location of your boot.properties file, for example:

java "$LOGGING_CONFIG" $JAVA_OPTS -classpath "$OPENIDM_HOME/bin/*:$OPENIDM_HOME/bundle/*" \     -Didm.envconfig.dirs="/etc/idm/altresolver/" \      -Dopenidm.system.server.root="$OPENIDM_HOME" \      org.forgerock.openidm.shell.impl.Main "$@"

Set IDM_ENVCONFIG_DIRS when running the script

You can specify this environment variable when you run the command-line utilities as follows:

/opt/openidm$ IDM_ENVCONFIG_DIRS=/etc/idm/altresolver ./cli.sh Executing ./cli.sh... Starting shell in /opt/openidm Using boot properties at /etc/idm/altresolver/boot.properties

Setting system variables (IDM 5.x)

You can either edit your cli.sh script to make the changes permanent or specify the JAVA_OPTS when you run the script.

Edit the cli.sh script

You should update the cli.sh script by inserting the following system variables above the java $JAVA_OPTS -classpath line:

JAVA_OPTS="$JAVA_OPTS -Dopenidm.boot.file=/path/to/project/dir/conf/boot/boot.properties" JAVA_OPTS="$JAVA_OPTS -Dlauncher.project.location=/path/to/project/dir"

The changes would look like this if your project directory was /etc/openidm:

JAVA_OPTS="$JAVA_OPTS -Dopenidm.boot.file=/etc/openidm/conf/boot/boot.properties" JAVA_OPTS="$JAVA_OPTS -Dlauncher.project.location=/etc/openidm" java $JAVA_OPTS -classpath "$OPENIDM_HOME/bin/*:$OPENIDM_HOME/bundle/*" \     -Dopenidm.system.server.root="$OPENIDM_HOME" \      org.forgerock.openidm.shell.impl.Main "$@"

Set JAVA_OPTS when running the script

You can specify these options when you run the command-line utilities as follows (with an example project directory of /etc/openidm):

/opt/openidm$ JAVA_OPTS='-Dopenidm.boot.file=/etc/openidm/conf/boot/boot.properties -Dlauncher.project.location=/etc/openidm' ./cli.sh Executing ./cli.sh...  Starting shell in /opt/openidm  Using boot properties at /etc/openidm/conf/boot/boot.properties

See Also

Administering and configuring IDM

Setup Guide › Command-Line Interface

Setup Guide › Expression Evaluation and Order of Precedence

IDM 6 Release Notes › Deprecated Functionality

Related Training

N/A

Related Issue Tracker IDs

N/A


Copyright and Trademarks Copyright © 2021 ForgeRock, all rights reserved.