Kbase 19886: Sample .bat for Installing SonicMQ Broker as Windows Service
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  07/01/2003 |
|
SUMMARY:
This solution applies to SonicMQ Versions 2000.x, 3.x and 4.x. It
illustrates how to start a SonicMQ broker as a Windows service.
SOLUTION:
You can use the command lines below in a .bat file to install a
SonicMQ 3.x broker as a Windows service.
For SonicMQ 2000.x, modify as per comments included below.
As noted in the comments of this bat file, make sure that you change [SonicMQ install-dir],[service-name],-u, and -p to the correct values for your system, service, and broker.
IMPORTANT -> Make sure that each command line is one continuous line. The formatting of this kbase will break up the lines and cause it not to run correctly.
You may also refer to your startbr.bat file; variables used below when
installing SonicMQ as an NT service should have the same values as
they do in startbr.bat, which is used to start the server manually.
REM @ECHO OFF
REM Change SONICMQ_HOME to your SONICMQ install directory
set SONICMQ_HOME=[SonicMQ install-dir]
GOTO CheckArgs
:Usage
ECHO.
ECHO Usage: smqService.bat action
ECHO action - Either install or remove
ECHO.
GOTO End
:CheckArgs
IF "%1" == "remove" GOTO Remove
IF "%1" == "install" GOTO Install
GOTO Usage
:Install
REM For SonicMQ 3.5 to 4.x,
set SONICMQ_JRE=%SONICMQ_HOME%\jre\bin\java.exe
REM For SonicMQ 2000.x to 3.0,
REM set SONICMQ_JRE=%SONICMQ_HOME%\Java\bin\jre.exe
set SONICMQ_LIB=%SONICMQ_HOME%\lib
REM For SonicMQ 3.5 to 4.x,
set JRE_CLASSPATH=%SONICMQ_HOME%\jre\lib\rt.jar
REM For SonicMQ 2000.x to 3.0,
REM set JRE_CLASSPATH=%SONICMQ_HOME%\Java\lib\rt.jar
REM For SonicMQ 3.x to 4.x,
set SONICMQ_SSL_LIB=%SONICMQ_HOME%\lib\sslj.jar;
%SONICMQ_HOME%\lib\certj.jar;%SONICMQ_HOME%\lib\jsafe.jar
REM For SonicMQ 2000.x,
REM set SONICMQ_SSL_LIB=%SONICMQ_HOME%\lib\jsafeSSLNetscape.jar
REM If you want to use ORACLE 8i database,
REM set SONICMQ_DBCLASS
variable to point to ORACLE JDBC driver
if not "%SONICMQ_DBCLASS%" == "" goto DBCL_SET
set SONICMQ_DBCLASS=%SONICMQ_LIB%\defdb_server.jar
:DBCL_SET
set SONICMQ_CP=%JRE_CLASSPATH%;%SONICMQ_LIB%\broker.jar;
%SONICMQ_LIB%\jetty.jar;%SONICMQ_LIB%\webclient.jar;
%SONICMQ_LIB%\gnu-regexp-1.0.6.jar;%SONICMQ_DBCLASS%;%SONICMQ_SSL_LIB%
set JVM_PARAM=-ms32m -mx256m -ss64k -oss64k
REM Change -install to your service name. Change -u and -p to your
username and password.
REM Add any additional arguments that you need.
"%SONICMQ_HOME%\bin\SonicServiceSetup" -install [service-name]
-jre="%SONICMQ_JRE%" "%JVM_PARAM%" -home="%SONICMQ_HOME%\broker.ini" -b=localhost:
2506 -u=Administrator -p="" -cp="%SONICMQ_CP%"
GOTO End
:Remove
REM change -remove to your service name
"%SONICMQ_HOME%\bin\SonicServiceSetup" -remove [service-name]
GOTO End
:End
References to Written Documentation:
SonicMQ 2000.x Installation and Administration Guide,
Ch. 1, Installation, "Running SonicMQ as a Windows Service"
SonicMQ 3.x Installation Configuration & Administration Guide,
Ch. 1, Installation, "Setting Up SonicMQ as a Windows Service"
SonicMQ 4.x Deployment Guide,
Ch. 3, Setting Up SonicMQ Components, "Setting Up SonicMQ as a
Windows Service"
Sonic Knowledge Base Solution 19629:
SonicMQ: Problems Starting Windows SonicMQ Broker Services