2013-04-10 74 views
0

我正在编写脚本以自动将ear部署到websphere并在应用程序上创建变量。Websphere bat文件退出批处理文件

我的问题是的manageprofiles和startserver的BAT文件的退出我的批处理和去下一步我要调用它多次

这里是我的脚本

FOR /F "tokens=*" %%i in ('type params.properties') do SET %%i 
REM SET PATH=%PATH%;%AppServerPath%\bin 
REM CALL setupCmdLine.bat -create -profileName %profile% -profilePath "%AppServerPath%\profiles\%profile%" -templatePath "%AppServerPath%\profileTemplates\default" 

"%AppServerPath%\bin\manageprofiles" -listProfiles | findstr -i %profile% > nul: 
if %ERRORLEVEL%==1 (
    ECHO Creating profile %profile% on %AppServerPath%\profiles\%profile% 
    "%AppServerPath%\bin\manageprofiles" -create -profileName %profile% -profilePath "%AppServerPath%\profiles\%profile%" -templatePath "%AppServerPath%\profileTemplates\default" 
) 

ECHO Getting profile path 
FOR /F "delims=" %%a IN ('manageprofiles -getPath -profileName %profile%') DO @SET PROFILEPATH=%%a 

REM SET PATH=%OLD_PATH%;%PROFILEPATH%\bin 
FOR /F "tokens=7 delims= " %%H IN ('serverStatus server1 ^| findstr "Application Server"') DO (
    IF /I "%%H" NEQ "STARTED" (
v  ECHO Starting server1 
     startServer server1 
    ) 
) 

"%PROFILEPATH%\bin\wsadmin" -lang jython -f EEDeployer.jy "%PROFILEPATH%" 

任何意见或替代检查一个配置文件,并创建它,如果不存在,然后启动server1吗?

回答

1

您需要CALL批处理以允许处理返回到主批处理。

如果您只是在批次内执行批次,则会传输控制权,但不会记录任何退货。

CALL "%AppServerPath%\bin\manageprofiles" ... 

应该解决你的问题。重复启动服务器...

+0

有时你只是没有看到最明显的。 (撞在砖墙上的头) – rojanu 2013-04-10 12:58:30

相关问题