Chapter 2. Starting and Stopping JBoss EAP 2.1. Starting JBoss EAP JBoss EAP is supported on Red Hat Enterprise Linux, Windows Server, and Oracle Solaris, and runs in either a standalone server or managed domain operating mode. The specific command to start JBoss EAP depends on the underlying platform and the desired operating mode. Servers are initially started in a suspended state and will not accept any requests until all required services have started, at which time the servers are placed into a normal running state and can start accepting requests. Start JBoss EAP as a Standalone Server Note For Windows Server, use the EAP_HOME \bin\standalone.bat script. This startup script uses the EAP_HOME /bin/standalone.conf file, or standalone.conf.bat for Windows Server, to set some default preferences, such as JVM options. You can customize the settings in this file. JBoss EAP uses the standalone.xml configuration file by default, but can be started using a different one. For details on the available standalone configuration files and how to use them, see the Standalone Server Configuration Files section. For a complete listing of all available startup script arguments and their purposes, use the --help argument or see the Server runtime arguments and switches section. Start JBoss EAP in a Managed Domain The domain controller must be started before the servers in any of the server groups in the domain. Use this script to first start the domain controller, and then for each associated host controller. Note For Windows Server, use the EAP_HOME \bin\domain.bat script. This startup script uses the EAP_HOME /bin/domain.conf file, or domain.conf.bat for Windows Server, to set some default preferences, such as JVM options. You can customize the settings in this file. JBoss EAP uses the host.xml host configuration file by default, but can be started using a different one. For details on the available managed domain configuration files and how to use them, see the Managed Domain Configuration Files section. When setting up a managed domain, additional arguments will need to be passed into the startup script. For a complete listing of all available startup script arguments and their purposes, use the --help argument or see the Server runtime arguments and switches section. 2.2. Stopping JBoss EAP The way that you stop JBoss EAP depends on how it was started. Stop an Interactive Instance of JBoss EAP Press Ctrl+C in the terminal where JBoss EAP was started. Stop a Background Instance of JBoss EAP Use the management CLI to connect to the running instance and shut down the server. Launch the management CLI. Issue the shutdown command. Note When running in a managed domain, you must specify the host name to shut down by using the --host argument with the shutdown command. 2.3. Running JBoss EAP in Admin-only Mode JBoss EAP has the ability to be started in admin-only mode. This enables JBoss EAP to run and accept management requests but not start other runtime services or accept end user requests. Admin-only mode is available in both standalone servers as well as managed domains . Running a Standalone Server in Admin-only Mode Start the Server in Admin-only Mode To start a JBoss EAP instance in admin-only mode, use the --start-mode=admin-only runtime argument when starting the JBoss EAP instance. Check If the Server is Running in Admin-only Mode Use the following command to check the running mode of the server. The result will be ADMIN_ONLY if the server is running in admin-only mode. Note Additionally, you can check the initial running mode in which JBoss EAP was launched by using the following command. Reload in a Different Mode from the Management CLI In addition to stopping and starting a JBoss EAP instance with a different runtime switch, the management CLI may also be used to reload it in a different mode. To reload the server in admin-only mode: To reload the server in normal mode: Note that if the server was started in admin-only mode and no --start-mode argument is specified to the reload command, the server will be started in normal mode. Running a Managed Domain in Admin-only Mode In a managed domain, if a domain controller is started in admin-only mode, it will not accept incoming connections from slave host controllers. Start a Host Controller in Admin-only Mode Pass in the --admin-only runtime argument to start a host controller in admin-only mode. Check If a Host Controller is Running in Admin-only Mode Use the following command to check the running mode of a host controller. The result will be ADMIN_ONLY if the host controller is running in admin-only mode. Reload in a Different Mode from the Management CLI In addition to stopping and starting a host controller with a different runtime switch, the management CLI may also be used to reload it in a different mode. To reload the host controller in admin-only mode: To reload a host controller in normal mode: Note that if the host controller was started in admin-only mode and no --admin-only argument is specified to the reload command, the host controller will be started in normal mode. 2.4. Suspend and Shut Down JBoss EAP Gracefully JBoss EAP can be suspended or shut down gracefully. This allows active requests to complete normally, without accepting any new requests. A timeout value specifies how long that the suspend or shut down operation will wait for active requests to complete. While the server is suspended, management requests are still processed. Graceful shutdown is coordinated at a server-wide level, mostly focused on the entry points at which a request enters the server. The following subsystems support graceful shutdown: Undertow The undertow subsystem will wait for all requests to finish. mod_cluster The modcluster subsystem will notify the load balancer that the server is suspending in the PRE_SUSPEND phase. ejb3 The ejb3 subsystem will wait for all remote Jakarta Enterprise Beans requests and MDB message deliveries to finish. Delivery to MDBs is stopped in the PRE_SUSPEND phase. Jakarta Enterprise Beans timers are suspended, and missed timers will be activated when the server is resumed. Transactions Once suspended, the server will not accept new requests, but in-flight transactions and requests are allowed to continue until they complete or until the timeout period expires. This also applies for web service requests associated with an XTS transaction. Note By default, transaction graceful shutdown is disabled for the ejb subsystem. You must enable transaction graceful shutdown if you want the server to wait for Jakarta Enterprise Beans-related transactions to complete before suspending. For example: Jakarta Concurrency The server will wait for all active jobs to finish. All queued jobs will be skipped. Currently, since Jakarta Concurrency does not have persistence, those queued jobs that were skipped will be lost. While the server is in a suspended state, scheduled tasks will continue to execute at their scheduled times but will throw a java.lang.IllegalStateException . Once the server is resumed, scheduled tasks will continue to execute normally, and in most cases tasks will not need to be rescheduled. Batch The server will stop all running jobs within the timeout period and defer all scheduled jobs. Note Graceful shutdown currently will not reject new inbound Jakarta Messaging messages. Jakarta Batch jobs and Jakarta Concurrency tasks scheduled by in-flight activity are currently allowed to proceed; however, Jakarta Concurrency tasks submitted that pass the timeout window currently error when executed. Requests are tracked by the request-controller subsystem. Without this subsystem, suspend and resume capabilities are very limited and the server will not wait for requests to complete before suspending or shutting down; however, if you do not need this capability, the request-controller subsystem can be removed for a small performance improvement. 2.4.1. Suspend Servers JBoss EAP 7 introduced a suspend mode, which suspends server operations gracefully. This allows all active requests to complete normally, but will not accept any new requests. Once the server has been suspended, it can be shut down, returned back to a running state, or left in a suspended state to perform maintenance. Note The management interfaces are not impacted by suspending the server. The server can be suspended and resumed using the management console or the management CLI. Check the Server Suspend State The server suspend state can be viewed using the following management CLI commands. The resulting value will be one of RUNNING , PRE_SUSPEND , SUSPENDING , or SUSPENDED . Check the suspend state for a standalone server. Check the suspend state for a server in a managed domain. Suspend Use the following management CLI commands to suspend the server, specifying the timeout value, in seconds, for the server to wait for active requests to complete. The default is 0 , which will suspend immediately. A value of -1 will cause the server to wait indefinitely for all active requests to complete. Each example waits up to 60 seconds for requests to complete before suspending. Suspend a standalone server. Suspend all servers in a managed domain. Suspend a single server in a managed domain. Suspend all servers in a server group. Suspend all servers at the host level. Resume The resume command returns the server to a normal running state to accept new requests. You can initiate the command at the host, server, server group, or domain level. For example: Start a Server in a Suspended State You can start a server in a suspended state so that no requests are accepted by the server until it is resumed. To start a standalone server in a suspended state, use the --start-mode=suspend runtime argument when starting the JBoss EAP instance. To start a managed domain server in a suspended state, pass the start-mode=suspend argument to the start operation in the management CLI command. Note You can also pass the start-mode argument to the reload and restart operations for a server. To start all servers in a managed domain server group in a suspended state, pass the start-mode=suspend argument to the start-servers operation in the management CLI command. Note You can also pass the start-mode argument to the reload-servers and restart-servers operations for a server group. 2.4.2. Shut Down Servers Gracefully Using the Management CLI A server will be shut down gracefully if an appropriate timeout value is specified when stopping the server. Once the command is issued, the server will be suspended and will wait up to the specified timeout for all requests to finish before shutting down. Use the following management CLI commands to shut down the server gracefully. Specify the timeout value, in seconds, for the server to wait for active requests to complete. The default is 0 , which will shut down the server immediately. A value of -1 will cause the server to wait indefinitely for all active requests to complete before shutting down. Each example waits up to 60 seconds for requests to complete before shutting down. Shut down a standalone server gracefully. Stop all servers in a managed domain gracefully. Stop a single server in a managed domain gracefully. Stop all servers in a server group gracefully. Shutdown the host controller and all the servers it manages. Note The suspend-timeout attribute is only applied to the servers managed by the host controller, not the host controller itself. 2.4.3. Shut Down Servers Gracefully Using an OS Signal A server can be shut down gracefully by sending an OS TERM signal, such as with kill -15 PID . By default, this value is identical to the management CLI's shutdown --suspend-timeout=0 command, resulting in immediate termination of any currently processing requests. The timeout can be configured by org.wildfly.sigterm.suspend.timeout system property, indicating the maximum number of seconds to wait for requests to complete before the server shuts down. A value of -1 indicates that the server will wait indefinitely. Important In a managed domain OS signals should not be used to shut down servers. Instead, servers should be shut down using the management CLI and through the managing Host Controller. Graceful shutdown using an OS signal will not work if the JVM is configured to disable signal handling, such as if the -Xrs java argument has been passed to the JVM options, or if the signal sent is not one the process can respond to, such as if a KILL signal is sent. 2.5. Starting and Stopping JBoss EAP (RPM Installation) Starting and stopping JBoss EAP is different for an RPM installation compared to a ZIP or installer installation. 2.5.1. Starting JBoss EAP (RPM Installation) The command for starting an RPM installation of JBoss EAP depends on which operating mode you want to start, a standalone server or a managed domain, and which Red Hat Enterprise Linux version you are running. Start JBoss EAP as a Standalone Server (RPM Installation) For Red Hat Enterprise Linux 6: For Red Hat Enterprise Linux 7 and later: This will start JBoss EAP using the standalone.xml configuration file by default. You can start JBoss EAP with a different standalone server configuration file by setting a property in the RPM service configuration file . For more information, see the Configure RPM Service Properties section below. Start JBoss EAP in a Managed Domain (RPM Installation) For Red Hat Enterprise Linux 6: For Red Hat Enterprise Linux 7 and later: This will start JBoss EAP using the host.xml configuration file by default. You can start JBoss EAP with a different managed domain configuration file by setting a property in the RPM service configuration file . For more information, see the Configure RPM Service Properties section below. Configure RPM Service Properties This section shows you how to configure the RPM service properties and other startup options for your JBoss EAP installation. Note that it is recommended to back up your configuration files before making modifications. For a listing of all available startup options for an RPM installation, see the RPM Service Configuration Properties section. Important For Red Hat Enterprise Linux 7 and later, RPM service configuration files are loaded using systemd , so variable expressions are not expanded. Specify the server configuration file. When starting a standalone server, the standalone.xml file is used by default. When running in a managed domain, the host.xml file is used by default. You can start JBoss EAP with a different configuration file by setting the WILDFLY_SERVER_CONFIG property in the appropriate RPM configuration file , for example, eap7-standalone.conf . Bind to a specific IP address. By default, a JBoss EAP RPM installation binds to 0.0.0.0 . You can bind JBoss EAP to a specific IP address by setting the WILDFLY_BIND property in the appropriate RPM configuration file , for example, eap7-standalone.conf . Note If you want to bind the management interfaces to a specific IP address, this can be configured in the JBoss EAP startup configuration file as shown in the example. Set JVM options or Java properties. You can specify JVM options or Java properties to pass into the JBoss EAP startup script by editing the startup configuration file. This file is EAP_HOME /bin/standalone.conf for a standalone server or EAP_HOME /bin/domain.conf for a managed domain. The below example configures the heap size and binds the JBoss EAP management interfaces to an IP address. Note If required, the JBoss EAP bind address must be configured using the WILDFLY_BIND property and not using the jboss.bind.address standard property here. Note If a property has the same name in both the RPM service configuration file, such as /etc/sysconfig/eap7-standalone , and in the JBoss EAP startup configuration file, such as EAP_HOME /bin/standalone.conf , the value that takes precedence is the one in the JBoss EAP startup configuration file. One such property is JAVA_HOME . 2.5.2. Stopping JBoss EAP (RPM Installation) The command for stopping an RPM installation of JBoss EAP depends on which operating mode that was started, a standalone server or a managed domain, and which Red Hat Enterprise Linux version you are running. Stop JBoss EAP as a Standalone Server (RPM Installation) For Red Hat Enterprise Linux 6: For Red Hat Enterprise Linux 7 and later: Stop JBoss EAP in a Managed Domain (RPM Installation) For Red Hat Enterprise Linux 6: For Red Hat Enterprise Linux 7 and later: For a listing of all available startup options for an RPM installation, see the RPM Service Configuration Files section. 2.6. PowerShell Scripts (Windows Server) Important The collection of PowerShell scripts is provided as Technology Preview only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs), might not be functionally complete, and Red Hat does not recommend to use them for production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process. See Technology Preview Features Support Scope on the Red Hat Customer Portal for information about the support scope for Technology Preview features. JBoss EAP includes PowerShell script equivalents for most of the JBoss EAP management scripts. This includes a PowerShell script to start JBoss EAP on Microsoft Windows Server. The JBoss EAP PowerShell scripts are designed to work with PowerShell version 2 and newer running on tested versions of Windows Server. The JBoss EAP PowerShell scripts are located in EAP_HOME \bin , and are used in mostly the same way as the JBoss EAP batch scripts. For example, to start a standalone JBoss EAP server with the standalone-full.xml configuration file, use the following PowerShell command: Note Arguments of the JBoss EAP PowerShell scripts must be in quotes.

Commands:
EAP_HOME /bin/standalone.sh
EAP_HOME /bin/domain.sh
EAP_HOME /bin/jboss-cli.sh --connect
shutdown
EAP_HOME /bin/standalone.sh --start-mode=admin-only
:read-attribute(name=running-mode) { "outcome" => "success", "result" => "ADMIN_ONLY" }
/core-service=server-environment:read-attribute(name=initial-running-mode)
reload --start-mode=admin-only
reload --start-mode=normal
EAP_HOME /bin/domain.sh --admin-only
/host= HOST_NAME :read-attribute(name=running-mode) { "outcome" => "success", "result" => "ADMIN_ONLY" }
reload --host= HOST_NAME --admin-only=true
reload --host= HOST_NAME --admin-only=false
/subsystem=ejb3:write-attribute(name=enable-graceful-txn-shutdown,value=true)
:read-attribute(name=suspend-state)
/host=master/server=server-one:read-attribute(name=suspend-state)
:suspend(suspend-timeout=60)
:suspend-servers(suspend-timeout=60)
/host=master/server-config=server-one:suspend(suspend-timeout=60)
/server-group=main-server-group:suspend-servers(suspend-timeout=60)
/host=master:suspend-servers(suspend-timeout=60)
:resume
EAP_HOME /bin/standalone.sh --start-mode=suspend
/host= HOST_NAME /server-config= SERVER_NAME :start(start-mode=suspend)
/server-group= SERVER_GROUP_NAME :start-servers(start-mode=suspend)
shutdown --suspend-timeout=60
:stop-servers(suspend-timeout=60)
/host=master/server-config=server-one:stop(suspend-timeout=60)
/server-group=main-server-group:stop-servers(suspend-timeout=60)
/host=master:shutdown(suspend-timeout=60)
service eap7-standalone start
systemctl start eap7-standalone.service
service eap7-domain start
systemctl start eap7-domain.service
WILDFLY_SERVER_CONFIG=standalone-full.xml
WILDFLY_BIND=192.168.0.1
JAVA_OPTS="USDJAVA_OPTS -Xms2048m -Xmx2048m" JAVA_OPTS="USDJAVA_OPTS -Djboss.bind.address.management=192.168.0.1"
service eap7-standalone stop
systemctl stop eap7-standalone.service
service eap7-domain stop
systemctl stop eap7-domain.service
.\standalone.ps1 "-c=standalone-full.xml"