Usage Note 40725: Adding a command switch to stop the JBoss Web-application server immediately in Microsoft Windows operating environments
Under Windows, you can stop a JBoss Web-application process immediately by adding a command switch to kill the process.
Notes:
- The option that you add in the following steps actually kills the Windows process IDs that are associated with the wrapper.exe file and the java.exe files.
- Killing the Jboss process immediately stops the server as well as any Web applications that are deployed on the server.
To add a command switch, you must modify the SASServer(x).bat file, as follows:
- In the the SASServer(x).bat file that is found in JBOSS_installation_directory\bin\, add the following lines between the existing :resume and :status blocks:
:kill
set /p wrappervar=< "%WRAPPER_DIR%\%SERVICENAME%.wrapperpid"
set /p javavar=< "%WRAPPER_DIR%\%SERVICENAME%.javapid"
TASKKILL /F /PID %wrappervar%
TASKKILL /F /PID %javavar%
goto end
Example
:resume
net continue "%SERVICENAME%"
if %ERRORLEVEL% == 0 echo JBoss server resumed as a service
goto end
:kill
set /p wrappervar=< "%WRAPPER_DIR%\%SERVICENAME%.wrapperpid"
set /p javavar=< "%WRAPPER_DIR%\%SERVICENAME%.javapid"
TASKKILL /F /PID %wrappervar%
TASKKILL /F /PID %javavar%
goto end
:status
sc interrogate "%SERVICENAME%"
goto end
- Add the following lines after the line that contains if %1 EQU -status goto status:
if %1 EQU kill goto kill
if %1 EQU -kill goto kill
Example
if %1 EQU -status goto status
if %1 EQU kill goto kill
if %1 EQU -kill goto kill
goto usage
- Update the :usage lines to reflect the new command
:usage
echo USAGE: %0 {install ^| start ^| stop ^| restart ^| pause ^| resume ^| remove ^| status ^| kill}
goto end
- Save the file
- Then, edit the wrapper.conf file in JBOSS_installation_directory\server\SASServer1\ by adding the following lines to the end of the file:
# Pids
wrapper.pidfile = JBoss – SASServer1.wrapperpid
wrapper.java.pidfile = JBoss – SASServer1.javapid
# Name of the service
wrapper.ntservice.name=JBoss – SASServer1
Note: JBoss – SASServer1 is the name of the service as it is designated in the wrapper.ntservice.name= parameter.
- Save the file
To use the new switch, you can open a command prompt, change to the JBOSS_installation_directory\bin\ directory, and type the command:
SASServer(x).bat kill
You should see the following text as output:
C:\jboss-4.2.0.GA\bin>SASServer1.bat kill
SUCCESS: The process with PID 6544 has been terminated.
SUCCESS: The process with PID 4112 has been terminated.
Operating System and Release Information
| SAS System | JBoss Application Server | Microsoft Windows Server 2003 for x64 | 4.2.0 | | | |
| Microsoft Windows Server 2003 Standard Edition | 4.2.0 | | | |
| Microsoft Windows Server 2003 Enterprise Edition | 4.2.0 | | | |
| Microsoft Windows Server 2003 Datacenter Edition | 4.2.0 | | | |
| Microsoft Windows NT Workstation | 4.2.0 | | | |
| Microsoft Windows 2000 Professional | 4.2.0 | | | |
| Microsoft Windows 2000 Server | 4.2.0 | | | |
| Microsoft Windows 2000 Datacenter Server | 4.2.0 | | | |
| Microsoft Windows 2000 Advanced Server | 4.2.0 | | | |
| Microsoft Windows 95/98 | 4.2.0 | | | |
| Microsoft® Windows® for x64 | 4.2.0 | | | |
| Microsoft Windows Server 2008 | 4.2.0 | | | |
| Microsoft Windows Server 2008 for x64 | 4.2.0 | | | |
| Microsoft Windows XP Professional | 4.2.0 | | | |
| Windows 7 Enterprise 32 bit | 4.2.0 | | | |
| Windows 7 Enterprise x64 | 4.2.0 | | | |
| Windows 7 Home Premium 32 bit | 4.2.0 | | | |
| Windows 7 Home Premium x64 | 4.2.0 | | | |
| Windows 7 Professional 32 bit | 4.2.0 | | | |
| Windows 7 Professional x64 | 4.2.0 | | | |
| Windows 7 Ultimate 32 bit | 4.2.0 | | | |
| Windows 7 Ultimate x64 | 4.2.0 | | | |
| Windows Millennium Edition (Me) | 4.2.0 | | | |
| Windows Vista | 4.2.0 | | | |
| Windows Vista for x64 | 4.2.0 | | | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
| Date Modified: | 2010-08-31 11:03:07 |
| Date Created: | 2010-08-30 08:58:17 |