Administer Liberty from the command line

We can use the server command and ws-server.jar executable JAR file to create a server, to start, or stop a server, to check whether it is running, or debug a server.

The latest documentation for Liberty server commands is available on the Open Liberty website.

To with control the server process we use:

    cd $LIBERTY/wlp/bin
    server <action> [server] [options]

Auto-scalable warning: The administrative console allows a start and a stop of a Liberty server that is a cluster member of an auto-scalable cluster, but only when the server is in maintenance mode. Starting or stopping a Liberty server from the command line when the Liberty server is a cluster member of an auto-scalable cluster can lead to unpredictable results.

This script supports the following actions:

    create Create a new server.
    debug Run the named server in the console foreground after a debugger connects to the debug port. The default port is 7777. We can use the WLP_DEBUG_ADDRESS variable to specify an alternative port.
    dump Create a snapshot of a server and save the result into an archive file
    javadump Create a snapshot of the server JVM and save the result into files. Each memory dump type creates a file, but not all memory dump types are supported by all virtual machines. The default directory for memory dump files is ${server.output.dir}. To set a different default directory, we must use an IBM JVM and set the following environment variables:            

    • IBM_HEAPDUMPDIR
    • IBM_COREDIR
    • IBM_JAVACOREDIR

    list List the defined Liberty application servers.
    package Packages a server.
    pause Pause all components that can be paused on the server. To pause specific components, use the --target option.
    resume Resume all components that can be paused on the server. To resume specific components, use the --target option.
    run Launch the server in the foreground.
    start Start the server as a background process.
    stop Stop a running server.
    status Check to see whether a specified server is running.
    version Display the version information of current server and Java runtime environment.
    help Get command-line script help, including details of more options.

Note: If a server is not specified on the command line, the action is performed against the default server instance, defaultServer, if it exists. We can also carry out similar actions using the executable JAR file ws-server.jar that is in the ${wlp.install.dir}/bin/tools directory.


Example

Run the server script:

To run the executable JAR file ws-server.jar without using the server script:

    java -javaagent:bin/tools/ws-javaagent.jar -jar bin/tools/ws-server.jar server_name --create
    java -javaagent:bin/tools/ws-javaagent.jar -jar bin/tools/ws-server.jar server_name
    java -javaagent:bin/tools/ws-javaagent.jar -jar bin/tools/ws-server.jar --help

The --help option provides information about more command-line parameters for the executable JAR file ws-server.jar, such as --stop, --version, --clean, --include.


Parent topic: Administer Liberty manually


Related information