-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for Red Hat JBoss Operations Network
2.3.2. Running the JBoss ON Server as a Service
The JBoss ON server can be configured to run as a service, managed with systems tools, on both Red Hat Enterprise Linux and Windows.
2.3.2.1. Configuring the JBoss ON Server as a Service on Red Hat Enterprise Linux
The
rhq-server.sh
script can be managed by the init
process so that the server starts automatically when the system boots. This also allows the server process to be managed by services like service
and chkconfig
.
- Copy the
rhq-server.sh
script into the/etc/init.d/
directory.cp serverRoot/bin/rhq-server.sh /etc/init.d/
- Edit the
/etc/init.d/rhq-server.sh
script to set theRHQ_SERVER_HOME
variable to the JBoss ON server install directory and theRHQ_SERVER_JAVA_HOME
variable to the appropriate directory for the JVM. For example:RHQ_SERVER_HOME=serverRoot/jon-server-3.1.2.GA1/
RHQ_SERVER_JAVA_HOME=/usr/
- Edit the
/etc/init.d/rhq-server.sh
script, and add the following lines to the top of the file, directly under#!/bin/sh
.#!/bin/sh #chkconfig: 2345
95 20
#description: JBoss Operations Network Server #processname: run.shThe last two numbers in the#chkconfig: 2345 95 20
line specify the start and stop priority, respectively, for the JBoss ON server. - Add the service to the
chkconfig
service management command, and verify that it was added properly.chkconfig --add rhq-server.sh chkconfig rhq-server.sh --list
- Set the
rhq-server.sh
service to run at run level 5.chkconfig --level 5 rhq-server.sh on
Once the
init
scripts and chkconfig
files are updated, then the JBoss ON server can be started and stopped using the service
command. The status of the process can also be checked.
service rhq-server.sh {start|stop|status}
2.3.2.2. Configuring JBoss ON as a Windows Service
The
rhq-server.bat
script has an installation option that installs the script as a Windows service. Once installed, the JBoss ON server can be started, stopped, and managed through Windows tools (Add and Remove Programs and Services) or through the rhq-server.bat
script.
- Set the environment variable to run the Windows service as.Every Windows service has to run as some system user. There are two environment variables in the
rhq-server.bat
script that set the user to use:RHQ_SERVER_RUN_AS
sets any Windows user to be the JBoss ON server user. The username given here must be in the standard Windows format, DOMAIN\user, such asEXAMPLEDOMAIN\jsmith
.RHQ_SERVER_RUN_AS_ME
sets the server to run as whoever the current user is. This overrides theRHQ_SERVER_RUN_AS
, if both as set.
If neither environment variable is set, then the JBoss ON server runs as the system account. - Run the
rhq-server.bat
script with theinstall
option to set up the service. This prompts for the password of whatever user account is used for the JBoss ON service.serverRoot\bin\rhq-server.bat install
After the service is set up, the JBoss ON server can be started or stopped using Windows administrative tools or by using any of the options in Table 4, “rhq-server.bat Options” with the script.
Table 4. rhq-server.bat Options
Option | Description |
---|---|
start | Starts the server service. |
stop | Stops the server service. |
status | Prints the current status (running or stopped) of the service. |
remove | Removes, or uninstalls, the JBoss ON server service. |
The JBoss ON server Windows service can be modified by changing or adding parameters in the service wrapper configuration file, serverRoot
\bin\wrapper\rhq-server-wrapper.conf
. Table 5, “Common Wrapper Properties” lists some of the wrapper properties that are most commonly edited.
Note
Before editing the wrapper file, check out the list of properties in the Java Service Wrapper documentation at http://wrapper.tanukisoftware.org/doc/english/properties.html.
Table 5. Common Wrapper Properties
Parameter | Description |
---|---|
wrapper.app.parameter.# | Passes command-line options to the server (the JBoss AS container). Each individual option and its value must be given its own wrapper configuration property and must be placed in numerical order.
Important
Do not change any of the five default properties, wrapper.app.parameter.1 . The number for new properties must begin at 5.
|
wrapper.java.additional.# | Passes additional options to the virtual machine, such as -Xmx or -D . Increments the parameters upward numerically.
Important
Do not edit the wrapper.java.additiona.1 property unless you want to point to your own log configuration file. Any other properties can be added, removed, or modified.
wrapper.java.additional.5=-XX:+DisableExplicitGC |
wrapper.ntservice.starttype | Sets the start type, either automatically when the system boots (AUTO_START ) or manually (DEMAND_START ). |
Alternatively, the wrapper service can be configured by creating a wrapper include file, in the serverRoot
\bin\wrapper\rhq-server-wrapper.inc
. An include file augments the service wrapper configuration file and is the recommended way to add more Java VM.