此内容没有您所选择的语言版本。
4.3. Running the JBoss ON Server as a Service
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.shscript into the/etc/init.d/directory.cp serverRoot/bin/rhq-server.sh /etc/init.d/
cp serverRoot/bin/rhq-server.sh /etc/init.d/Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Edit the
/etc/init.d/rhq-server.shscript to set theRHQ_SERVER_HOMEvariable to the JBoss ON server install directory and theRHQ_SERVER_JAVA_HOMEvariable to the appropriate directory for the JVM. For example:RHQ_SERVER_HOME=serverRoot/jon-server-3.0.0.GA1/
RHQ_SERVER_HOME=serverRoot/jon-server-3.0.0.GA1/Copy to Clipboard Copied! Toggle word wrap Toggle overflow RHQ_SERVER_JAVA_HOME=/usr/
RHQ_SERVER_JAVA_HOME=/usr/Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Edit the
/etc/init.d/rhq-server.shscript, 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.sh
#!/bin/sh #chkconfig: 2345 95 20 #description: JBoss Operations Network Server #processname: run.shCopy to Clipboard Copied! Toggle word wrap Toggle overflow The last two numbers in the#chkconfig: 2345 95 20line specify the start and stop priority, respectively, for the JBoss ON server. - Add the service to the
chkconfigservice management command, and verify that it was added properly.chkconfig --add rhq-server.sh chkconfig rhq-server.sh --list
chkconfig --add rhq-server.sh chkconfig rhq-server.sh --listCopy to Clipboard Copied! Toggle word wrap Toggle overflow - Set the
rhq-server.shservice to run at run level 5.chkconfig --level 5 rhq-server.sh on
chkconfig --level 5 rhq-server.sh onCopy to Clipboard Copied! Toggle word wrap Toggle overflow
4.3.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.
- 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.batscript that set the user to use:RHQ_SERVER_RUN_ASsets 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_MEsets 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.batscript with theinstalloption 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
serverRoot\bin\rhq-server.bat installCopy to Clipboard Copied! Toggle word wrap Toggle overflow