Every so often I do something worth remembering and/or mentioning. This blog is for those times. It is ultimately for my own consumption but its great if anyone finds it interesting or helpful.
Friday, December 16, 2011
Monday, December 12, 2011
Running Tomcat in the background on DOS
I came across a nifty bit of code that can start Apache Tomcat in the background on DOS. I'm so used to starting in Linux with nohop. But alas, nohop on DOS so I found this batch script (which can be used to start any process in the background)...
@echo off
if {%1}=={} @echo Syntax: HideBatch BatchFile [Param1 Param2 ... ParamN]&goto :EOF
setlocal
set VBS="%TEMP%\HideBatch.vbs"
if exist %VBS% goto Runit
@echo dim obj, obj1, obj2, objArgument>%VBS%
@echo Set WshShell = WScript.CreateObject("WScript.Shell")>>%VBS%
@echo Set objArgument = Wscript.Arguments>>%VBS%
@echo obj1=objArgument(0)>>%VBS%
@echo obj2=Replace(obj1, "```", """")>>%VBS%
@echo obj = WshShell.Run(obj2, 0)>>%VBS%
@echo set WshShell = Nothing>>%VBS%
:Runit
set param=%*
set param="%param:"=```%"
cscript //nologo %VBS% %param%
endlocal
It is simply a matter of executing this batch with the correct arguments for Tomcat...
$> launch.bat catalina.bat run
@echo off
if {%1}=={} @echo Syntax: HideBatch BatchFile [Param1 Param2 ... ParamN]&goto :EOF
setlocal
set VBS="%TEMP%\HideBatch.vbs"
if exist %VBS% goto Runit
@echo dim obj, obj1, obj2, objArgument>%VBS%
@echo Set WshShell = WScript.CreateObject("WScript.Shell")>>%VBS%
@echo Set objArgument = Wscript.Arguments>>%VBS%
@echo obj1=objArgument(0)>>%VBS%
@echo obj2=Replace(obj1, "```", """")>>%VBS%
@echo obj = WshShell.Run(obj2, 0)>>%VBS%
@echo set WshShell = Nothing>>%VBS%
:Runit
set param=%*
set param="%param:"=```%"
cscript //nologo %VBS% %param%
endlocal
It is simply a matter of executing this batch with the correct arguments for Tomcat...
$> launch.bat catalina.bat run
Subscribe to:
Posts (Atom)