Start and stop a server from the command line

We can use the server tasks to start or stop a server.

The latest documentation about server commands for Liberty is available on the Open Liberty website. The wlp/bin directory contains a script called server to help with controlling the server process. The syntax of this script is as follows:

    server action serverName [options]

For available values of [options], see Server command 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. Tip: Do not use the command line to start or stop a server that is managed by auto scaling with an enabled scaling policy.

  • Start the server:

      server start serverName

    where serverName is the name of the server.

  • Stop the server:

      server stop serverName

    where serverName is the name of the server.

    Note: Normal server stop includes a quiesce stage before the server is shutdown. The quiesce stage, a default period of 30 seconds, allows for services to perform pre-shutdown work, for example, stopping inbound listeners but allowing existing requests to complete. Applying the --force option to the stop command skips the quiesce stage. The --force option has no effect if server stop was already invoked. If we use the --force option, we might see unexpected exceptions in the messages.log file that occur after the server stop command was received by the server.


Example

To start or stop a server using the server script on Windows systems:

    server.bat start serverName

    server.bat stop serverName

To start or stop a server using the server script on other systems:

    server start serverName

    server stop serverName