batchManager command-line client utility

The batchManager command-line client utility provides a command-line interface for managing your batch jobs that run on Liberty.

The batchManager command-line client utility interacts with the batch manager over the batch manager's REST API.  To use the batchManager command-line client utility, the batch manager must be running on your Liberty server. Use the batch management feature to install  and enable the Liberty batch manager.

SSL configuration

The batchManager command-line client utility communicates with the batch manager over an SSL connection. To facilitate SSL communication with a batch manager that is running on a Liberty server, the utility must be able to verify the SSL certificate of the Liberty server.

If the SSL certificate is signed by a well-known certificate authority (CA), the utility can verify the certificate by the CA. No further configuration is necessary.

If the SSL certificate is not signed by a CA, then you must configure the utility to trust the SSL certificate of the server by doing one of the following actions.
  • Specify the option --trustSslCertificates, which configures the utility to trust all SSL certificates.
  • Include the server's SSL certificate in the utility's truststore.

If you choose to specify the option --trustSslCertificates, the utility trusts all SSL certificates that it receives and no further configuration is necessary.

If you choose the option to include the server's SSL certificate in the utility's truststore, then you must also configure the utility so that it can find its truststore. The utility is a stand-alone Java main. You configure SSL by using system properties such as javax.net.ssl.truststore.

 If the batch manager is running on the same machine as the utility, then you can point the utility directly at the server keystore:
   $ export JVM_ARGS="-Djavax.net.ssl.trustStore=/path/to/server/keystore.jks"
   $ batchManager submit ...
Attention: JVM arguments, such as -D properties, are passed to the batchManager command-line client utility by the JVM-ARGS environment variable.
If you cannot use the server keystore directly, you must export the server certificate from the server keystore and import it into the client truststore.  Use the JDK keytool utility for exporting and importing certificates.  In the following example, the server certificate is stored in the [server-dir]/resources/security/key.jks keystore file under the default alias, and the password is Liberty.
    $ keytool -export -alias default -file server.crt -keystore [server-dir]/resources/security/key.jks -storepass Liberty
    $ keytool -import -alias server_crt -file server.crt -keystore /path/to/truststore.jks -storepass passw0rd
Attention: The import command creates the truststore.jks file if the file does not exist.
    $ export JVM_ARGS="-Djavax.net.ssl.trustStore=/path/to/truststore.jks"
    $ batchManager submit ...

Commands and usage

The batchManager command-line client utility provides commands for submitting, stopping, restarting, and checking the status of jobs.

To generally use the utility:

$ batchManager [command] [options]

To see a list of available commands:

$ batchManager help

To see the description and options for a specific command:

$ batchManager help [command]

The following example illustrates how to submit a job and wait for its completion:

  $ batchManager submit \
        --batchManager=<host>:<port>
        --user=[credentials for logging into the batch manager]
        --password=[credentials for logging into the batch manager]
        --applicationName=[application name used when packaging the batch app]
        --jobXMLName=[job XML file basename in the app's batch-jobs dir]
        --wait

jobParametersFile and jobPropertiesFile

When submitting a batch job by using the batchManager client utility, the jobParametersFile and jobPropertiesFilesupports the use of multiple files separated by commas. Files later in the comma separated list take precedence over files that appear first in the list. The following example illustrates correct usage of the comma separated list.
jobParametersFile=filePath1,filePath2,filePath3
jobPropertiesFile=filePath1,filePath2,filePath3
As an example, --jobParametersFile=<filepath1> would override --jobParametersFile=<filepath1>,<filepath2> in the control properties file. The resulting parameter is --jobParametersFile=<filepath1>.

Return codes

The batchManager command-line client utility outputs the following return codes:
Code Description
0 The task completed normally.
20 A required argument was not specified.
21 An unrecognized argument was specified.
22 An invalid argument value was specified.
255 An unknown error occurred.
Note: If you specify the --wait argument, the utility outputs the following return codes about the status of the job that you are waiting for.
Code Description
33 The job stopped.
34 The job did not complete successfully.
35 The job completed successfully.
36 The job was abandoned.

Icon that indicates the type of topic Concept topic

File name: cwlp_jbatch_commandlineutil.html