Administering Liberty from the command line

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

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

About this task

The wlp/bin directory hcontains a script that is called server to help with controlling the server process. The syntax of this script is as follows:
server <action> [server] [options]

For available values of the options, see Server command options.

Avoid trouble: 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
A command that creates a new server.
debug
A command that runs the named server in the console foreground after a debugger connects to the debug port. The default port is 7777. You can use the WLP_DEBUG_ADDRESS variable to specify an alternative port.
dump
A command that creates a snapshot of a server and saves the result into an archive file for further tuning and diagnosis.
javadump
A command that creates a snapshot of the server Java™ virtual machine (JVM) and saves 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, you must use an IBM® JVM and set the following environment variables:            
  • IBM_HEAPDUMPDIR
  • IBM_COREDIR
  • IBM_JAVACOREDIR
list
A command that lists the defined Liberty application servers.
package
A command that packages a server.
pause
A command that pauses all components that can be paused on the server. To pause specific components, use the --target option. For more information on pause and resume, see Pausing and Resuming a Liberty server from the command line.
resume
A command that resumes all components that can be paused on the server. To resume specific components, use the --target option. For more information on pause and resume, see Pausing and Resuming a Liberty server from the command line.
run
A command that launches the server in the foreground.
start
A command that starts the server as a background process.
stop
A command that stops a running server.
status
A command that checks to see whether a specified server is running.
version
A command that displays the version information of current server and Java runtime environment.
help
A command that gets 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.
You can also carry out similar actions by using the executable JAR file ws-server.jar that is in the ${wlp.install.dir}/bin/tools directory.

Example

Run the server script:
server create server_name
server package server_name
server run server_name
server help server_name
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.