본문 바로가기
Tool/WEB,WAS

Jboss 7.1.1 as Windows service

by 하하IT 2020. 4. 27.

1. jboss 사이트에서  알맞은 download

 

http://www.jboss.org/jbossweb/downloads/jboss-native-2-0-10

 

2. service.bat  수정

다운받은 파일은 jBoss 5.0 기준으로 작성되어 있으므로 7.1 기준으로 수정함

 

--------------------------------기존파일(5.0)에서  7.1 기준으로 수정한 파일내용-------------------

--------------------------------서비스로 등록하여 부팅시 서비스 시작 확인, 그외는 미확인----------

-------------------------------run.log는 로그위치를 수정가능함.---------------------------------

@echo off
REM JBoss, the OpenSource webOS
REM
REM Distributable under LGPL license.
REM See terms of license at gnu.org.
REM
REM -------------------------------------------------------------------------
REM JBoss Service Script for Windows
REM -------------------------------------------------------------------------


@if not "%ECHO%" == "" echo %ECHO%
@if "%OS%" == "Windows_NT" setlocal
set DIRNAME=%CD%

REM
REM VERSION, VERSION_MAJOR and VERSION_MINOR are populated
REM during the build with ant filter.
REM
set SVCNAME=JBAS71SVC
set SVCDISP=JBoss Application Server 7.1.1
set SVCDESC=JBoss Application Server 7.1.1 GA/Platform: Windows x86
set NOPAUSE=Y

REM Suppress killing service on logoff event
set JAVA_OPTS=-Xrs

REM Figure out the running mode

if /I "%1" == "install"   goto cmdInstall
if /I "%1" == "uninstall" goto cmdUninstall
if /I "%1" == "start"     goto cmdStart
if /I "%1" == "stop"      goto cmdStop
if /I "%1" == "restart"   goto cmdRestart
if /I "%1" == "signal"    goto cmdSignal
echo Usage: service install^|uninstall^|start^|stop^|restart^|signal
goto cmdEnd

REM jbosssvc retun values
REM ERR_RET_USAGE           1
REM ERR_RET_VERSION         2
REM ERR_RET_INSTALL         3
REM ERR_RET_REMOVE          4
REM ERR_RET_PARAMS          5
REM ERR_RET_MODE            6

:errExplain
if errorlevel 1 echo Invalid command line parameters
if errorlevel 2 echo Failed installing %SVCDISP%
if errorlevel 4 echo Failed removing %SVCDISP%
if errorlevel 6 echo Unknown service mode for %SVCDISP%
goto cmdEnd

:cmdInstall
jbosssvc.exe -imwdc %SVCNAME% "%DIRNAME%" "%SVCDISP%" "%SVCDESC%" service.bat
if not errorlevel 0 goto errExplain
echo Service %SVCDISP% installed
goto cmdEnd

:cmdUninstall
jbosssvc.exe -u %SVCNAME%
if not errorlevel 0 goto errExplain
echo Service %SVCDISP% removed
goto cmdEnd






:cmdStart
REM Executed on service start
del .r.lock 2>&1 | findstr /C:"being used" > nul
if not errorlevel 1 (
  echo Could not continue. Locking file already in use.
  goto cmdEnd
)
echo Y > .r.lock
jbosssvc.exe -p 1 "Starting %SVCDISP%" > run.log
call standalone.bat --server-config=standalone.xml -b 0.0.0.0 < .r.lock >> run.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> run.log
del .r.lock
goto cmdEnd







:cmdStop
REM Executed on service stop
echo Y > .s.lock
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" > shutdown.log
call jboss-cli.bat --connect command=:shutdown < .s.lock >> shutdown.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> shutdown.log
del .s.lock
goto cmdEnd

:cmdRestart
REM Executed manually from command line
REM Note: We can only stop and start
echo Y > .s.lock
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" >> shutdown.log
call shutdown -S < .s.lock >> shutdown.log 2>&1
del .s.lock
:waitRun
REM Delete lock file
del .r.lock > nul 2>&1
REM Wait one second if lock file exist
jbosssvc.exe -s 1
if exist ".r.lock" goto waitRun
echo Y > .r.lock
jbosssvc.exe -p 1 "Restarting %SVCDISP%" >> run.log
call run.bat < .r.lock >> run.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> run.log
del .r.lock
goto cmdEnd

:cmdSignal
REM Send signal to the service.
REM Requires jbosssch.dll to be loaded in JVM
@if not ""%2"" == """" goto execSignal
echo Missing signal parameter.
echo Usage: service signal [0...9]
goto cmdEnd
:execSignal
jbosssvc.exe -k%2 %SVCNAME%
goto cmdEnd

:cmdEnd

------------------------------------------------------------------------------------------------

 

 

 

------------------어디선가 가져온  소스...---------------------------------------------------------------------------------

@echo off

REM JBoss, the OpenSource webOS

REM

REM Distributable under LGPL license.

REM See terms of license at gnu.org.

REM

REM -------------------------------------------------------------------------

REM JBoss Service Script for Windows

REM -------------------------------------------------------------------------

 

 

 

 

@if not "%ECHO%" == "" echo %ECHO%

@if "%OS%" == "Windows_NT" setlocal

set DIRNAME=%CD%

 

 

REM

REM VERSION, VERSION_MAJOR and VERSION_MINOR are populated

REM during the build with ant filter.

REM

set SVCNAME=JBAS50SVC

set SVCDISP=JBoss Application Server 7.1.1

set SVCDESC=JBoss Application Server 7.1.1 Platform: Windows x64

set NOPAUSE=Y

 

 

REM Suppress killing service on logoff event

set JAVA_OPTS=-Xrs

 

 

REM Figure out the running mode

 

 

if /I "%1" == "install" goto cmdInstall

if /I "%1" == "uninstall" goto cmdUninstall

if /I "%1" == "start" goto cmdStart

if /I "%1" == "stop" goto cmdStop

if /I "%1" == "restart" goto cmdRestart

if /I "%1" == "signal" goto cmdSignal

echo Usage: service install^|uninstall^|start^|stop^|restart^|signal

goto cmdEnd

 

 

REM jbosssvc retun values

REM ERR_RET_USAGE 1

REM ERR_RET_VERSION 2

REM ERR_RET_INSTALL 3

REM ERR_RET_REMOVE 4

REM ERR_RET_PARAMS 5

REM ERR_RET_MODE 6

 

 

:errExplain

if errorlevel 1 echo Invalid command line parameters

if errorlevel 2 echo Failed installing %SVCDISP%

if errorlevel 4 echo Failed removing %SVCDISP%

if errorlevel 6 echo Unknown service mode for %SVCDISP%

goto cmdEnd

 

 

:cmdInstall

jbosssvc.exe -imwdc %SVCNAME% "%DIRNAME%" "%SVCDISP%" "%SVCDESC%" service.bat

if not errorlevel 0 goto errExplain

echo Service %SVCDISP% installed

goto cmdEnd

 

 

:cmdUninstall

jbosssvc.exe -u %SVCNAME%

if not errorlevel 0 goto errExplain

echo Service %SVCDISP% removed

goto cmdEnd

 

 

:cmdStart

REM Executed on service start

del .r.lock 2>&1 | findstr /C:"being used" > nul

if not errorlevel 1 (

echo Could not continue. Locking file already in use.

goto cmdEnd

)

echo Y > .r.lock

jbosssvc.exe -p 1 "Starting %SVCDISP%" > C:\opt\jboss7\standalone\log\standalone.log

call standalone.bat --server-config=standalone.xml < .r.lock >> C:\opt\jboss7\standalone\log\standalone.log 2>&1

jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> C:\opt\jboss7\standalone\log\standalone.log

del .r.lock

goto cmdEnd

 

 

:cmdStop

REM Executed on service stop

echo Y > .s.lock

jbosssvc.exe -p 1 "Shutting down %SVCDISP%" > C:\opt\jboss7\standalone\log\shutdown.log

call jboss-cli.bat --connect command=:shutdown >> C:\opt\jboss7\standalone\log\shutdown.log 2>&1

jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> C:\opt\jboss7\standalone\log\shutdown.log

del .s.lock

goto cmdEnd

 

 

:cmdRestart

REM Executed manually from command line

REM Note: We can only stop and start

echo Y > .s.lock

jbosssvc.exe -p 1 "Shutting down %SVCDISP%" >> C:\opt\jboss7\standalone\log\shutdown.log

call jboss-cli.bat --connect command=:shutdown >> C:\opt\jboss7\standalone\log\shutdown.log 2>&1

del .s.lock

:waitRun

REM Delete lock file

del .r.lock > nul 2>&1

REM Wait one second if lock file exist

jbosssvc.exe -s 1

if exist ".r.lock" goto waitRun

echo Y > .r.lock

jbosssvc.exe -p 1 "Restarting %SVCDISP%" >> C:\opt\jboss7\standalone\log\standalone.log

call standalone.bat --server-config=standalone.xml < .r.lock >> C:\opt\jboss7\standalone\log\standalone.log 2>&1

jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> C:\opt\jboss7\standalone\log\standalone.log

del .r.lock

goto cmdEnd

 

 

:cmdSignal

REM Send signal to the service.

REM Requires jbosssch.dll to be loaded in JVM

@if not ""%2"" == """" goto execSignal

echo Missing signal parameter.

echo Usage: service signal [0...9]

goto cmdEnd

:execSignal

jbosssvc.exe -k%2 %SVCNAME%

goto cmdEnd

 

 

:cmdEnd

---------------------------------------------------------------------------------------------------

 

 

3. 다운받은 파일에서  README-service.txt  참고하여

   서비스 등록

  service.bat install  

   --> 혹시 서비스 등록중 오류가 발생하면  권한문제 일수 있으니   jbosssvc.exe 을  관리자 권한으로 실행 체크함

 

 

4.  서비스 자동으로 설정되었는지 확인

   시작 > 제어판 > 관리도구 > 서비스 > 해당 서비스의 시작유형이 "자동" 인지 확인

 

 

jboss-native-2.0.10-windows-x86-ssl.zip
1.14MB

'Tool > WEB,WAS' 카테고리의 다른 글

tomcat / windows / log4j / log4j.properties  (0) 2023.09.20
tomcat / catalina.out / 일자별 log  (0) 2021.10.05
WAS / jBoss 7.1  (0) 2020.04.24
WAS / jboss 5.1 Administration Console password change  (0) 2020.04.24
nginx default.conf  (0) 2019.04.10