Discussion:
Launch batch file and pass control back to VBScript
(too old to reply)
Highlander
2008-11-18 17:20:33 UTC
Permalink
(sorry about the duplicate post - forgot to include this group)

(watch for word wrap below)

Hello all.

Here's a section of VBScript code I've got on a Windows 2003 server:

==================================================
strAppServer = "WAS_AppServer5"
strCMD = "%COMSPEC% /c LaunchAppServer.bat " & strAppServer
Set objCMD = objShell.Exec(strCMD)
sPIDText = "open for e-business; process id is"
StartTime = Timer( )
Do
'~~ Get the output of strCMD
IF Not objCMD.StdOut.AtEndOfStream Then
strLine = objCMD.StdOut.ReadLine
WScript.Echo strLine
End IF
'~~ If process id text is present, exit loop
IF inStr(1, strLine, sPIDText, 1) Then
Exit Do
End IF
'~~ If timeout is reached, exit loop
IF Timer( ) > StartTime + 300 Then
WScript.Echo vbCrlf & "*** TIMED OUT ***"
Exit Do
End IF
WScript.Sleep 100
Loop
EndTime = Timer( )
sElapsed = "Elapsed seconds: " & (EndTime - StartTime)
WScript.Echo vbCrlf & sElapsed & vbCrlf
==================================================


This VBScript, configured to run when the server reboots, is designed
to start the WebSphere Application Servers on the machine. (there are
6). This script essentially launches the batch file
"LaunchAppServer.bat":

=================================================
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
=================================================

In the section of VBScript code above, I'm capturing the output of
objShell.Exec(strCMD). When an Application Server starts up
successfully, the correct output looks like this:

========================================================
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is
364
========================================================


The problem is that one of the 6 WebSphere Application Servers on the
machine doesn't start up. The last line of the output is:

"ADMU3200I: Server launched. Waiting for initialization status."

And then it just waits forever.

I've put a timer in the VBScript code, so that after 5 minutes it will
cease waiting, and continue processing the VBScript. That doesn't work
however, because it appears that control is still in the "startserver"
process; control is never passed back to the VBScript. The very last
thing the VBScript does is output the line "...Waiting for
initialization status." And that's it.

How can I configure the VBScript or the batch file it launches to
insure that control is passed back to the VBScript?

Any help would be greatly appreciated. Thanks!

- Dave
Pegasus (MVP)
2008-11-18 19:23:57 UTC
Permalink
Post by Highlander
(sorry about the duplicate post - forgot to include this group)
(watch for word wrap below)
Hello all.
==================================================
strAppServer = "WAS_AppServer5"
strCMD = "%COMSPEC% /c LaunchAppServer.bat " & strAppServer
Set objCMD = objShell.Exec(strCMD)
sPIDText = "open for e-business; process id is"
StartTime = Timer( )
Do
'~~ Get the output of strCMD
IF Not objCMD.StdOut.AtEndOfStream Then
strLine = objCMD.StdOut.ReadLine
WScript.Echo strLine
End IF
'~~ If process id text is present, exit loop
IF inStr(1, strLine, sPIDText, 1) Then
Exit Do
End IF
'~~ If timeout is reached, exit loop
IF Timer( ) > StartTime + 300 Then
WScript.Echo vbCrlf & "*** TIMED OUT ***"
Exit Do
End IF
WScript.Sleep 100
Loop
EndTime = Timer( )
sElapsed = "Elapsed seconds: " & (EndTime - StartTime)
WScript.Echo vbCrlf & sElapsed & vbCrlf
==================================================
This VBScript, configured to run when the server reboots, is designed
to start the WebSphere Application Servers on the machine. (there are
6). This script essentially launches the batch file
=================================================
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
=================================================
In the section of VBScript code above, I'm capturing the output of
objShell.Exec(strCMD). When an Application Server starts up
========================================================
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is
364
========================================================
The problem is that one of the 6 WebSphere Application Servers on the
"ADMU3200I: Server launched. Waiting for initialization status."
And then it just waits forever.
I've put a timer in the VBScript code, so that after 5 minutes it will
cease waiting, and continue processing the VBScript. That doesn't work
however, because it appears that control is still in the "startserver"
process; control is never passed back to the VBScript. The very last
thing the VBScript does is output the line "...Waiting for
initialization status." And that's it.
How can I configure the VBScript or the batch file it launches to
insure that control is passed back to the VBScript?
Any help would be greatly appreciated. Thanks!
- Dave
In your batch file

@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1

what is "startserver"? Is it an .exe file? A .bat file? How do you know that
"startserver" finishes? Have you tried monitoring it, e.g. like so:

@ECHO OFF

echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
Highlander
2008-11-18 20:32:57 UTC
Permalink
Post by Pegasus (MVP)
Post by Highlander
(sorry about the duplicate post - forgot to include this group)
(watch for word wrap below)
Hello all.
==================================================
strAppServer = "WAS_AppServer5"
strCMD = "%COMSPEC% /c LaunchAppServer.bat " & strAppServer
Set objCMD = objShell.Exec(strCMD)
sPIDText = "open for e-business; process id is"
StartTime = Timer( )
Do
 '~~ Get the output of strCMD
 IF Not objCMD.StdOut.AtEndOfStream Then
   strLine = objCMD.StdOut.ReadLine
   WScript.Echo strLine
 End IF
 '~~ If process id text is present, exit loop
 IF inStr(1, strLine, sPIDText, 1) Then
   Exit Do
 End IF
 '~~ If timeout is reached, exit loop
 IF Timer( ) > StartTime + 300 Then
   WScript.Echo vbCrlf & "*** TIMED OUT ***"
   Exit Do
 End IF
 WScript.Sleep 100
Loop
EndTime = Timer( )
sElapsed = "Elapsed seconds: " & (EndTime - StartTime)
WScript.Echo vbCrlf & sElapsed & vbCrlf
==================================================
This VBScript, configured to run when the server reboots, is designed
to start the WebSphere Application Servers on the machine. (there are
6). This script essentially launches the batch file
=================================================
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
=================================================
In the section of VBScript code above, I'm capturing the output of
objShell.Exec(strCMD). When an Application Server starts up
========================================================
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is
364
========================================================
The problem is that one of the 6 WebSphere Application Servers on the
"ADMU3200I: Server launched. Waiting for initialization status."
And then it just waits forever.
I've put a timer in the VBScript code, so that after 5 minutes it will
cease waiting, and continue processing the VBScript. That doesn't work
however, because it appears that control is still in the "startserver"
process; control is never passed back to the VBScript. The very last
thing the VBScript does is output the line "...Waiting for
initialization status." And that's it.
How can I configure the VBScript or the batch file it launches to
insure that control is passed back to the VBScript?
Any help would be greatly appreciated. Thanks!
- Dave
In your batch file
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
what is "startserver"? Is it an .exe file? A .bat file? How do you know that
@ECHO OFF
echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
- Hide quoted text -
- Show quoted text -
"startserver" is the batch file startserver.bat:

=======================================================
@echo off
SETLOCAL
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\startServer.bat" %*
ENDLOCAL
set MYERRORLEVEL=%ERRORLEVEL%
if defined PROFILE_CONFIG_ACTION exit %MYERRORLEVEL% else exit /b
%MYERRORLEVEL%
=======================================================

So you're saying I should try modifying LaunchAppServer.bat to the
following:

echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
Pegasus (MVP)
2008-11-18 21:24:55 UTC
Permalink
Post by Pegasus (MVP)
Post by Highlander
(sorry about the duplicate post - forgot to include this group)
(watch for word wrap below)
Hello all.
==================================================
strAppServer = "WAS_AppServer5"
strCMD = "%COMSPEC% /c LaunchAppServer.bat " & strAppServer
Set objCMD = objShell.Exec(strCMD)
sPIDText = "open for e-business; process id is"
StartTime = Timer( )
Do
'~~ Get the output of strCMD
IF Not objCMD.StdOut.AtEndOfStream Then
strLine = objCMD.StdOut.ReadLine
WScript.Echo strLine
End IF
'~~ If process id text is present, exit loop
IF inStr(1, strLine, sPIDText, 1) Then
Exit Do
End IF
'~~ If timeout is reached, exit loop
IF Timer( ) > StartTime + 300 Then
WScript.Echo vbCrlf & "*** TIMED OUT ***"
Exit Do
End IF
WScript.Sleep 100
Loop
EndTime = Timer( )
sElapsed = "Elapsed seconds: " & (EndTime - StartTime)
WScript.Echo vbCrlf & sElapsed & vbCrlf
==================================================
This VBScript, configured to run when the server reboots, is designed
to start the WebSphere Application Servers on the machine. (there are
6). This script essentially launches the batch file
=================================================
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
=================================================
In the section of VBScript code above, I'm capturing the output of
objShell.Exec(strCMD). When an Application Server starts up
========================================================
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is
364
========================================================
The problem is that one of the 6 WebSphere Application Servers on the
"ADMU3200I: Server launched. Waiting for initialization status."
And then it just waits forever.
I've put a timer in the VBScript code, so that after 5 minutes it will
cease waiting, and continue processing the VBScript. That doesn't work
however, because it appears that control is still in the "startserver"
process; control is never passed back to the VBScript. The very last
thing the VBScript does is output the line "...Waiting for
initialization status." And that's it.
How can I configure the VBScript or the batch file it launches to
insure that control is passed back to the VBScript?
Any help would be greatly appreciated. Thanks!
- Dave
In your batch file
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
what is "startserver"? Is it an .exe file? A .bat file? How do you know that
@ECHO OFF
echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
- Hide quoted text -
- Show quoted text -
"startserver" is the batch file startserver.bat:

=======================================================
@echo off
SETLOCAL
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\startServer.bat" %*
ENDLOCAL
set MYERRORLEVEL=%ERRORLEVEL%
if defined PROFILE_CONFIG_ACTION exit %MYERRORLEVEL% else exit /b
%MYERRORLEVEL%
=======================================================

So you're saying I should try modifying LaunchAppServer.bat to the
following:

echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1

===================

Well, yes, that's the starting point I'm suggesting.
Highlander
2008-11-18 21:50:57 UTC
Permalink
Post by Highlander
Post by Pegasus (MVP)
Post by Highlander
(sorry about the duplicate post - forgot to include this group)
(watch for word wrap below)
Hello all.
==================================================
strAppServer = "WAS_AppServer5"
strCMD = "%COMSPEC% /c LaunchAppServer.bat " & strAppServer
Set objCMD = objShell.Exec(strCMD)
sPIDText = "open for e-business; process id is"
StartTime = Timer( )
Do
'~~ Get the output of strCMD
IF Not objCMD.StdOut.AtEndOfStream Then
strLine = objCMD.StdOut.ReadLine
WScript.Echo strLine
End IF
'~~ If process id text is present, exit loop
IF inStr(1, strLine, sPIDText, 1) Then
Exit Do
End IF
'~~ If timeout is reached, exit loop
IF Timer( ) > StartTime + 300 Then
WScript.Echo vbCrlf & "*** TIMED OUT ***"
Exit Do
End IF
WScript.Sleep 100
Loop
EndTime = Timer( )
sElapsed = "Elapsed seconds: " & (EndTime - StartTime)
WScript.Echo vbCrlf & sElapsed & vbCrlf
==================================================
This VBScript, configured to run when the server reboots, is designed
to start the WebSphere Application Servers on the machine. (there are
6). This script essentially launches the batch file
=================================================
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
=================================================
In the section of VBScript code above, I'm capturing the output of
objShell.Exec(strCMD). When an Application Server starts up
========================================================
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is
364
========================================================
The problem is that one of the 6 WebSphere Application Servers on the
"ADMU3200I: Server launched. Waiting for initialization status."
And then it just waits forever.
I've put a timer in the VBScript code, so that after 5 minutes it will
cease waiting, and continue processing the VBScript. That doesn't work
however, because it appears that control is still in the "startserver"
process; control is never passed back to the VBScript. The very last
thing the VBScript does is output the line "...Waiting for
initialization status." And that's it.
How can I configure the VBScript or the batch file it launches to
insure that control is passed back to the VBScript?
Any help would be greatly appreciated. Thanks!
- Dave
In your batch file
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
what is "startserver"? Is it an .exe file? A .bat file? How do you know that
@ECHO OFF
echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
- Hide quoted text -
- Show quoted text -
=======================================================
@echo off
SETLOCAL
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\startServer.bat" %*
ENDLOCAL
set MYERRORLEVEL=%ERRORLEVEL%
if defined PROFILE_CONFIG_ACTION exit %MYERRORLEVEL% else exit /b
%MYERRORLEVEL%
=======================================================
So you're saying I should try modifying LaunchAppServer.bat to the
echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
===================
Well, yes, that's the starting point I'm suggesting.- Hide quoted text -
- Show quoted text -
Thanks Pegasus I'll try that.
Tom Lavedas
2008-11-18 22:23:22 UTC
Permalink
Post by Highlander
Post by Pegasus (MVP)
Post by Highlander
(sorry about the duplicate post - forgot to include this group)
(watch for word wrap below)
Hello all.
==================================================
strAppServer = "WAS_AppServer5"
strCMD = "%COMSPEC% /c LaunchAppServer.bat " & strAppServer
Set objCMD = objShell.Exec(strCMD)
sPIDText = "open for e-business; process id is"
StartTime = Timer( )
Do
 '~~ Get the output of strCMD
 IF Not objCMD.StdOut.AtEndOfStream Then
   strLine = objCMD.StdOut.ReadLine
   WScript.Echo strLine
 End IF
 '~~ If process id text is present, exit loop
 IF inStr(1, strLine, sPIDText, 1) Then
   Exit Do
 End IF
 '~~ If timeout is reached, exit loop
 IF Timer( ) > StartTime + 300 Then
   WScript.Echo vbCrlf & "*** TIMED OUT ***"
   Exit Do
 End IF
 WScript.Sleep 100
Loop
EndTime = Timer( )
sElapsed = "Elapsed seconds: " & (EndTime - StartTime)
WScript.Echo vbCrlf & sElapsed & vbCrlf
==================================================
This VBScript, configured to run when the server reboots, is designed
to start the WebSphere Application Servers on the machine. (there are
6). This script essentially launches the batch file
=================================================
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
=================================================
In the section of VBScript code above, I'm capturing the output of
objShell.Exec(strCMD). When an Application Server starts up
========================================================
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is
364
========================================================
The problem is that one of the 6 WebSphere Application Servers on the
"ADMU3200I: Server launched. Waiting for initialization status."
And then it just waits forever.
I've put a timer in the VBScript code, so that after 5 minutes it will
cease waiting, and continue processing the VBScript. That doesn't work
however, because it appears that control is still in the "startserver"
process; control is never passed back to the VBScript. The very last
thing the VBScript does is output the line "...Waiting for
initialization status." And that's it.
How can I configure the VBScript or the batch file it launches to
insure that control is passed back to the VBScript?
Any help would be greatly appreciated. Thanks!
- Dave
In your batch file
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
what is "startserver"? Is it an .exe file? A .bat file? How do you know that
@ECHO OFF
echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
- Hide quoted text -
- Show quoted text -
=======================================================
@echo off
SETLOCAL
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\startServer.bat" %*
ENDLOCAL
set MYERRORLEVEL=%ERRORLEVEL%
if defined PROFILE_CONFIG_ACTION exit %MYERRORLEVEL% else exit /b
%MYERRORLEVEL%
=======================================================
So you're saying I should try modifying LaunchAppServer.bat to the
echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
If I read Pegasus correctly, he is trying to collect information on
the operation of the batch. Specifically, he's trying to prove
whether the startserver application does or does not exit when there
is an error. It is not meant as a repair.

I would go one step further - have you ever run the application from a
command prompt manually when the targeted server does not start. In
particular, does the application issue a request for input? I'm
guessing that it does, because I tested your code, but substituted a
PAUSE statement for your batch procedure. The Do loop hung because
the Readline could not return the text since the line of output had
not ended. The PAUSE statement was sitting waiting for input.

One way to fix this is to replace the Readline with a Read(1) in a
loop and test the program's output after each character for indication
that input is required and then provide it when needed. In my test,
it looked like this ...

'~~ Get the output of strCMD
Do until objCMD.StdOut.AtEndOfStream
sChr = objCMD.StdOut.Read(1)
strLine = strline & sChr
if sChr = "." then objCMD.StdIn.Writeline "" ' provide an Enter to
end the PAUSE
loop
WScript.Echo strLine

This unblocks the READ statement. The Read has the advantage of
providing interim input to your test loop, but it will still block the
process if the correct response is not provided at the right time.

If the application is not waiting for user interaction I can think of
another way to proceed. That is to wrap the batch in a separate VBS
script (or a recursive entry to the original with suitable logic) and
then execute that procedure using either EXEC or RUN under Cscript
with it's timeout //T: switch set to 300 seconds. The help text
reads ...

//T:nn Time out in seconds: Maximum time a script is
permitted to run

The output will need to be redirected into a temporary file and read
from there by the original calling program to provide feedback. I
don't know if that will orphan the startserver application or not.
You'd need to check the Task Manager processes to be sure. If it dose
a WMI Terminat might be in order to clean things up. However, this
approach is too complicated to do if it's not really needed, so I'll
leave it at that.

HTH,

Tom Lavedas
***********
http://there.is.no.more/tglbatch/
Highlander
2008-11-19 21:49:18 UTC
Permalink
Post by Tom Lavedas
Post by Highlander
Post by Pegasus (MVP)
Post by Highlander
(sorry about the duplicate post - forgot to include this group)
(watch for word wrap below)
Hello all.
==================================================
strAppServer = "WAS_AppServer5"
strCMD = "%COMSPEC% /c LaunchAppServer.bat " & strAppServer
Set objCMD = objShell.Exec(strCMD)
sPIDText = "open for e-business; process id is"
StartTime = Timer( )
Do
 '~~ Get the output of strCMD
 IF Not objCMD.StdOut.AtEndOfStream Then
   strLine = objCMD.StdOut.ReadLine
   WScript.Echo strLine
 End IF
 '~~ If process id text is present, exit loop
 IF inStr(1, strLine, sPIDText, 1) Then
   Exit Do
 End IF
 '~~ If timeout is reached, exit loop
 IF Timer( ) > StartTime + 300 Then
   WScript.Echo vbCrlf & "*** TIMED OUT ***"
   Exit Do
 End IF
 WScript.Sleep 100
Loop
EndTime = Timer( )
sElapsed = "Elapsed seconds: " & (EndTime - StartTime)
WScript.Echo vbCrlf & sElapsed & vbCrlf
==================================================
This VBScript, configured to run when the server reboots, is designed
to start the WebSphere Application Servers on the machine. (there are
6). This script essentially launches the batch file
=================================================
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
=================================================
In the section of VBScript code above, I'm capturing the output of
objShell.Exec(strCMD). When an Application Server starts up
========================================================
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is
364
========================================================
The problem is that one of the 6 WebSphere Application Servers on the
"ADMU3200I: Server launched. Waiting for initialization status."
And then it just waits forever.
I've put a timer in the VBScript code, so that after 5 minutes it will
cease waiting, and continue processing the VBScript. That doesn't work
however, because it appears that control is still in the "startserver"
process; control is never passed back to the VBScript. The very last
thing the VBScript does is output the line "...Waiting for
initialization status." And that's it.
How can I configure the VBScript or the batch file it launches to
insure that control is passed back to the VBScript?
Any help would be greatly appreciated. Thanks!
- Dave
In your batch file
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
what is "startserver"? Is it an .exe file? A .bat file? How do you know that
@ECHO OFF
echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
- Hide quoted text -
- Show quoted text -
=======================================================
@echo off
SETLOCAL
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\startServer.bat" %*
ENDLOCAL
set MYERRORLEVEL=%ERRORLEVEL%
if defined PROFILE_CONFIG_ACTION exit %MYERRORLEVEL% else exit /b
%MYERRORLEVEL%
=======================================================
So you're saying I should try modifying LaunchAppServer.bat to the
echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
If I read Pegasus correctly, he is trying to collect information on
the operation of the batch.  Specifically, he's trying to prove
whether the startserver application does or does not exit when there
is an error.  It is not meant as a repair.
I would go one step further - have you ever run the application from a
command prompt manually when the targeted server does not start.  In
particular, does the application issue a request for input?  I'm
guessing that it does, because I tested your code, but substituted a
PAUSE statement for your batch procedure.  The Do loop hung because
the Readline could not return the text since the line of output had
not ended.  The PAUSE statement was sitting waiting for input.
One way to fix this is to replace the Readline with a Read(1) in a
loop and test the program's output after each character for indication
that input is required and then provide it when needed.  In my test,
it looked like this ...
  '~~ Get the output of strCMD
  Do until objCMD.StdOut.AtEndOfStream
    sChr = objCMD.StdOut.Read(1)
    strLine = strline & sChr
    if sChr = "." then objCMD.StdIn.Writeline "" ' provide an Enter to
end the PAUSE
  loop
    WScript.Echo strLine
This unblocks the READ statement.  The Read has the advantage of
providing interim input to your test loop, but it will still block the
process if the correct response is not provided at the right time.
If the application is not waiting for user interaction I can think of
another way to proceed.  That is to wrap the batch in a separate VBS
script (or a recursive entry to the original with suitable logic) and
then execute that procedure using either EXEC or RUN under Cscript
with it's timeout //T: switch set to 300 seconds.  The help text
reads ...
   //T:nn      Time out in seconds:  Maximum time a script is
permitted to run
The output will need to be redirected into a temporary file and read
from there by the original calling program to provide feedback.  I
don't know if that will orphan the startserver application or not.
You'd need to check the Task Manager processes to be sure.  If it dose
a WMI Terminat might be in order to clean things up.  However, this
approach is too complicated to do if it's not really needed, so I'll
leave it at that.
HTH,
Tom Lavedas
***********http://there.is.no.more/tglbatch/- Hide quoted text -
- Show quoted text -
(watch for word wrap below)

Pegasus,

To summarize, my VBScript code opens a command window which runs the
batch file LaunchAppServer.bat; with an argument of the AppServer
name:

strAppServer = "WAS_AppServer5"
strCMD = "%COMSPEC% /c LaunchAppServer.bat " & strAppServer
Set objCMD = objShell.Exec(strCMD)

LaunchAppServer.bat in turn runs the batch file startServer.bat; with
an argument of the same AppServer name:

----------------------- Begin LaunchAppServer.bat
-----------------------------------
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startServer %1
----------------------- End LaunchAppServer.bat
--------------------------------------


Per your recommendation, I modified the batch file startServer.bat to
check when it starts and ends:

--------------------------------- Begin startServer.bat
--------------------------------------------------
@echo off
@echo %date% %time% "startServer %*" has Started 1>> %*.txt 2>>&1
SETLOCAL
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\startServer.bat" %*
ENDLOCAL
set MYERRORLEVEL=%ERRORLEVEL%
@echo %date% %time% "startServer %*" has Ended 1>> %*.txt 2>>&1
if defined PROFILE_CONFIG_ACTION exit %MYERRORLEVEL% else exit /b
%MYERRORLEVEL%
--------------------------------- End startServer.bat
--------------------------------------------------

In my VBScript code I'm capturing the output of LaunchAppServer.bat.
When an Application Server starts up successfully, the correct output
now
looks like this:

========================================================
Wed 11/19/2008 14:40:57.63 "startServer WAS_AppServer4" has Started

ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is
364

Wed 11/19/2008 14:43:06.95 "startServer WAS_AppServer4" has Ended
========================================================

When an Application Server does NOT start up
successfully, the output looks like this:

========================================================
Wed 11/19/2008 14:43:07.57 "startServer WAS_AppServer5" has Started

ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.

========================================================

So it looks like (the final batch file in the process
VBScript => batch file => batch file) startServer.bat starts running,
but never finishes. The last output from startServer.bat is:
"ADMU3200I: Server launched. Waiting for initialization status"
and control is never passed back to my VBScript.

And therein lies the problem. I'd like the VBScript to be able to tell
when
an Application Server does NOT start up successfully.

Any ideas? Thanks.

- Dave
Pegasus (MVP)
2008-11-19 22:53:09 UTC
Permalink
Post by Tom Lavedas
Post by Highlander
Post by Pegasus (MVP)
Post by Highlander
(sorry about the duplicate post - forgot to include this group)
(watch for word wrap below)
Hello all.
==================================================
strAppServer = "WAS_AppServer5"
strCMD = "%COMSPEC% /c LaunchAppServer.bat " & strAppServer
Set objCMD = objShell.Exec(strCMD)
sPIDText = "open for e-business; process id is"
StartTime = Timer( )
Do
'~~ Get the output of strCMD
IF Not objCMD.StdOut.AtEndOfStream Then
strLine = objCMD.StdOut.ReadLine
WScript.Echo strLine
End IF
'~~ If process id text is present, exit loop
IF inStr(1, strLine, sPIDText, 1) Then
Exit Do
End IF
'~~ If timeout is reached, exit loop
IF Timer( ) > StartTime + 300 Then
WScript.Echo vbCrlf & "*** TIMED OUT ***"
Exit Do
End IF
WScript.Sleep 100
Loop
EndTime = Timer( )
sElapsed = "Elapsed seconds: " & (EndTime - StartTime)
WScript.Echo vbCrlf & sElapsed & vbCrlf
==================================================
This VBScript, configured to run when the server reboots, is designed
to start the WebSphere Application Servers on the machine. (there are
6). This script essentially launches the batch file
=================================================
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
=================================================
In the section of VBScript code above, I'm capturing the output of
objShell.Exec(strCMD). When an Application Server starts up
========================================================
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is
364
========================================================
The problem is that one of the 6 WebSphere Application Servers on the
"ADMU3200I: Server launched. Waiting for initialization status."
And then it just waits forever.
I've put a timer in the VBScript code, so that after 5 minutes it will
cease waiting, and continue processing the VBScript. That doesn't work
however, because it appears that control is still in the
"startserver"
process; control is never passed back to the VBScript. The very last
thing the VBScript does is output the line "...Waiting for
initialization status." And that's it.
How can I configure the VBScript or the batch file it launches to
insure that control is passed back to the VBScript?
Any help would be greatly appreciated. Thanks!
- Dave
In your batch file
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
what is "startserver"? Is it an .exe file? A .bat file? How do you know that
@ECHO OFF
echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
- Hide quoted text -
- Show quoted text -
=======================================================
@echo off
SETLOCAL
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\startServer.bat" %*
ENDLOCAL
set MYERRORLEVEL=%ERRORLEVEL%
if defined PROFILE_CONFIG_ACTION exit %MYERRORLEVEL% else exit /b
%MYERRORLEVEL%
=======================================================
So you're saying I should try modifying LaunchAppServer.bat to the
echo %date% %time% Startserver started 1>> c:\test.txt 2>>&1
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startserver %1
echo %date% %time% Startserver ended 1>> c:\test.txt 2>>&1
If I read Pegasus correctly, he is trying to collect information on
the operation of the batch. Specifically, he's trying to prove
whether the startserver application does or does not exit when there
is an error. It is not meant as a repair.
I would go one step further - have you ever run the application from a
command prompt manually when the targeted server does not start. In
particular, does the application issue a request for input? I'm
guessing that it does, because I tested your code, but substituted a
PAUSE statement for your batch procedure. The Do loop hung because
the Readline could not return the text since the line of output had
not ended. The PAUSE statement was sitting waiting for input.
One way to fix this is to replace the Readline with a Read(1) in a
loop and test the program's output after each character for indication
that input is required and then provide it when needed. In my test,
it looked like this ...
'~~ Get the output of strCMD
Do until objCMD.StdOut.AtEndOfStream
sChr = objCMD.StdOut.Read(1)
strLine = strline & sChr
if sChr = "." then objCMD.StdIn.Writeline "" ' provide an Enter to
end the PAUSE
loop
WScript.Echo strLine
This unblocks the READ statement. The Read has the advantage of
providing interim input to your test loop, but it will still block the
process if the correct response is not provided at the right time.
If the application is not waiting for user interaction I can think of
another way to proceed. That is to wrap the batch in a separate VBS
script (or a recursive entry to the original with suitable logic) and
then execute that procedure using either EXEC or RUN under Cscript
with it's timeout //T: switch set to 300 seconds. The help text
reads ...
//T:nn Time out in seconds: Maximum time a script is
permitted to run
The output will need to be redirected into a temporary file and read
from there by the original calling program to provide feedback. I
don't know if that will orphan the startserver application or not.
You'd need to check the Task Manager processes to be sure. If it dose
a WMI Terminat might be in order to clean things up. However, this
approach is too complicated to do if it's not really needed, so I'll
leave it at that.
HTH,
Tom Lavedas
***********http://there.is.no.more/tglbatch/- Hide quoted text -
- Show quoted text -
(watch for word wrap below)

Pegasus,

To summarize, my VBScript code opens a command window which runs the
batch file LaunchAppServer.bat; with an argument of the AppServer
name:

strAppServer = "WAS_AppServer5"
strCMD = "%COMSPEC% /c LaunchAppServer.bat " & strAppServer
Set objCMD = objShell.Exec(strCMD)

LaunchAppServer.bat in turn runs the batch file startServer.bat; with
an argument of the same AppServer name:

----------------------- Begin LaunchAppServer.bat
-----------------------------------
@ECHO OFF
D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startServer %1
----------------------- End LaunchAppServer.bat
--------------------------------------


Per your recommendation, I modified the batch file startServer.bat to
check when it starts and ends:

--------------------------------- Begin startServer.bat
--------------------------------------------------
@echo off
@echo %date% %time% "startServer %*" has Started 1>> %*.txt 2>>&1
SETLOCAL
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\startServer.bat" %*
ENDLOCAL
set MYERRORLEVEL=%ERRORLEVEL%
@echo %date% %time% "startServer %*" has Ended 1>> %*.txt 2>>&1
if defined PROFILE_CONFIG_ACTION exit %MYERRORLEVEL% else exit /b
%MYERRORLEVEL%
--------------------------------- End startServer.bat
--------------------------------------------------

In my VBScript code I'm capturing the output of LaunchAppServer.bat.
When an Application Server starts up successfully, the correct output
now
looks like this:

========================================================
Wed 11/19/2008 14:40:57.63 "startServer WAS_AppServer4" has Started

ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is
364

Wed 11/19/2008 14:43:06.95 "startServer WAS_AppServer4" has Ended
========================================================

When an Application Server does NOT start up
successfully, the output looks like this:

========================================================
Wed 11/19/2008 14:43:07.57 "startServer WAS_AppServer5" has Started

ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.

========================================================

So it looks like (the final batch file in the process
VBScript => batch file => batch file) startServer.bat starts running,
but never finishes. The last output from startServer.bat is:
"ADMU3200I: Server launched. Waiting for initialization status"
and control is never passed back to my VBScript.

And therein lies the problem. I'd like the VBScript to be able to tell
when
an Application Server does NOT start up successfully.

Any ideas? Thanks.

- Dave

=============================

When your application server starts successfully then you get to see these
log entries:

ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is364

When your application server does not start successfully then your log
entries look like this:
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.

From the above you can see that the log line
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is364
is missing from the failed log.

The 64-Dollar question now is: What generates the missin log line? Because
this is exactly the spot where your process stalls. AFAIKS, this has nothing
to do with scripting.

Another worrying point: You wrote this in your reply above:
------- Begin startServer.bat --------
@echo off
echo %date% %time% "startServer %*" has Started 1>> %*.txt 2>>&1
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startServer.bat" %*

In other words, you're showing us the contents of startServer.bat.
One of its lines invokes - wait for it! - startServer.bat. Do you have
a batch file that calls itself? This is a perfect recipe for setting up a
permanent loop with no exit . . .
Highlander
2008-11-24 17:24:56 UTC
Permalink
On Nov 19, 4:53 pm, "Pegasus \(MVP\)" <***@fly.com.oz> wrote:

-- snipped --


Pegasus -

Thanks for the reply. I've noticed that in your reply you've omitted
the group "ibm.software.websphere.application-server."

Please include that group in this thread; I'm hoping someone from that
group will respond to the (why is the start app server process
failing?) aspect of this.
Post by Pegasus (MVP)
When your application server starts successfully then you get to see these
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is364
When your application server does not start successfully then your log
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
From the above you can see that the log line
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is364
is missing from the failed log.
The 64-Dollar question now is: What generates the missin log line? Because
this is exactly the spot where your process stalls. AFAIKS, this has nothing
to do with scripting.
Yes the start app server process is stalling... but from a VBScript
standpoint, I don't need to know WHY it is stalling.

I just need to know THAT it is stalling. I'd like the VBScript to
detect that it has stalled, (by way of a timeout, absence of the
missing line, etc.) and continue on.

So this gets back to my original question. How can I configure the
VBScript, or the batch file it launches, to
insure that control is passed back to the VBScript? (so that it's
able to detect that the process has stalled, and move on)
Post by Pegasus (MVP)
------- Begin startServer.bat --------
@echo off
echo %date% %time% "startServer %*" has Started 1>> %*.txt 2>>&1
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startServer.bat" %*
In other words, you're showing us the contents of startServer.bat.
One of its lines invokes - wait for it! - startServer.bat. Do you have
a batch file that calls itself? This is a perfect recipe for setting up a
permanent loop with no exit . . .
Good point, but it doesn't apply in this case. The batch file calls
itself by design. This batch file came straight out of the box from
IBM as part of a Websphere installation. The only modification I've
made was adding the lines to echo the date and time.
Tom Lavedas
2008-11-24 18:24:03 UTC
Permalink
Post by Highlander
-- snipped --
Pegasus -
Thanks for the reply. I've noticed that in your reply you've omitted
the group "ibm.software.websphere.application-server."
Please include that group in this thread; I'm hoping someone from that
group will respond to the (why is the start app server process
failing?) aspect of this.
Post by Pegasus (MVP)
When your application server starts successfully then you get to see these
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is364
When your application server does not start successfully then your log
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
From the above you can see that the log line
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is364
is missing from the failed log.
The 64-Dollar question now is: What generates the missin log line? Because
this is exactly the spot where your process stalls. AFAIKS, this has nothing
to do with scripting.
Yes the start app server process is stalling... but from a VBScript
standpoint, I don't need to know WHY it is stalling.
I just need to know THAT it is stalling. I'd like the VBScript to
detect that it has stalled, (by way of a timeout, absence of the
missing line, etc.) and continue on.
So this gets back to my original question. How can I configure the
VBScript, or the batch file it launches, to
insure that control is passed back to the VBScript?  (so that it's
able to detect that the process has stalled, and move on)
Post by Pegasus (MVP)
------- Begin startServer.bat --------
@echo off
echo %date% %time% "startServer %*" has Started 1>> %*.txt 2>>&1
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startServer.bat" %*
In other words, you're showing us the contents of startServer.bat.
One of its lines invokes - wait for it! - startServer.bat. Do you have
a batch file that calls itself? This is a perfect recipe for setting up a
permanent loop with no exit . . .
Good point, but it doesn't apply in this case. The batch file calls
itself by design. This batch file came straight out of the box from
IBM as part of a Websphere installation. The only modification I've
made was adding the lines to echo the date and time.
I'm a bit confused. Did you ever read my earlier response to you? In
it I posited a couple of potential solutions. I also asked a question
that has never been answered to my satisfaction. In particular ...

"... - have you ever run the application from a command prompt
manually when the targeted server does not start. In particular, does
the application issue a request for input?"

If there is a request for input when run manually, then the answer is
to provide that input, as I outline in my previous response.

If there is no request for input, I outlined another solution ...

"If the application is not waiting for user interaction I can think of
another way to proceed. That is to wrap the batch in a separate VBS
script (or a recursive entry to the original with suitable logic) and
then execute that procedure using either EXEC or RUN under Cscript
with it's timeout //T: switch set to 300 seconds."

I never saw a response that rejected either of these approaches. That
seems to imply that you did not see my post, but your response of 19
Nov was threaded by groups.google as a response to my posting. Yet in
that response I only saw discussions relevant to Pegasus' questions.

So, as I said, I'm confused.

Tom Lavedas
***********
http://there.is.no.more/tglbatch/
Highlander
2008-11-25 16:57:08 UTC
Permalink
Post by Highlander
-- snipped --
Pegasus -
Thanks for the reply. I've noticed that in your reply you've omitted
the group "ibm.software.websphere.application-server."
Please include that group in this thread; I'm hoping someone from that
group will respond to the (why is the start app server process
failing?) aspect of this.
Post by Pegasus (MVP)
When your application server starts successfully then you get to see these
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is364
When your application server does not start successfully then your log
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
From the above you can see that the log line
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is364
is missing from the failed log.
The 64-Dollar question now is: What generates the missin log line? Because
this is exactly the spot where your process stalls. AFAIKS, this has nothing
to do with scripting.
Yes the start app server process is stalling... but from a VBScript
standpoint, I don't need to know WHY it is stalling.
I just need to know THAT it is stalling. I'd like the VBScript to
detect that it has stalled, (by way of a timeout, absence of the
missing line, etc.) and continue on.
So this gets back to my original question. How can I configure the
VBScript, or the batch file it launches, to
insure that control is passed back to the VBScript?  (so that it's
able to detect that the process has stalled, and move on)
Post by Pegasus (MVP)
------- Begin startServer.bat --------
@echo off
echo %date% %time% "startServer %*" has Started 1>> %*.txt 2>>&1
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startServer.bat" %*
In other words, you're showing us the contents of startServer.bat.
One of its lines invokes - wait for it! - startServer.bat. Do you have
a batch file that calls itself? This is a perfect recipe for setting up a
permanent loop with no exit . . .
Good point, but it doesn't apply in this case. The batch file calls
itself by design. This batch file came straight out of the box from
IBM as part of a Websphere installation. The only modification I've
made was adding the lines to echo the date and time.
I'm a bit confused.  Did you ever read my earlier response to you?  In
it I posited a couple of potential solutions.  I also asked a question
that has never been answered to my satisfaction.  In particular ...
"... - have you ever run the application from a command prompt
manually when the targeted server does not start.  In particular, does
the application issue a request for input?"
If there is a request for input when run manually, then the answer is
to provide that input, as I outline in my previous response.
If there is no request for input, I outlined another solution ...
"If the application is not waiting for user interaction I can think of
another way to proceed.  That is to wrap the batch in a separate VBS
script (or a recursive entry to the original with suitable logic) and
then execute that procedure using either EXEC or RUN under Cscript
with it's timeout //T: switch set to 300 seconds."
I never saw a response that rejected either of these approaches.  That
seems to imply that you did not see my post, but your response of 19
Nov was threaded by groups.google as a response to my posting.  Yet in
that response I only saw discussions relevant to Pegasus' questions.
So, as I said, I'm confused.
Tom Lavedas
***********http://there.is.no.more/tglbatch/- Hide quoted text -
- Show quoted text -
Tom -
Sorry about the confusion. Using Google Groups here. Whenever I reply
to a thread, I always click the "Reply" link on the bottom post of the
thread.

I did read your post; just didn't get around to replying to it. Yes
I've run the application from a command prompt - there is no request
for input involved here at all.

As for your suggestion to wrap the batch in a separate VBScript (or a
recursive entry to the original with suitable logic) and then execute
that procedure using a timeout switch... that does sound interesting,
but complicated. I'd have to get some specific direction from you to
code that. I was thinking of this option as being a last resort.

After my reply (to Pegasus) on 11/24 I was hoping Pegasus or someone
would have any suggestions (other than the one's you've made) as to
how I could configure the VBScript, or the batch file it launches, to
insure that control is passed back to the VBScript.

Thanks for your replies to this thread Tom, I do appreciate it.
Tom Lavedas
2008-11-25 18:53:57 UTC
Permalink
Post by Highlander
Post by Highlander
-- snipped --
Pegasus -
Thanks for the reply. I've noticed that in your reply you've omitted
the group "ibm.software.websphere.application-server."
Please include that group in this thread; I'm hoping someone from that
group will respond to the (why is the start app server process
failing?) aspect of this.
Post by Pegasus (MVP)
When your application server starts successfully then you get to see these
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is364
When your application server does not start successfully then your log
ADMU0128I: Starting tool with the AppSrv01 profile
ADMU3100I: Reading configuration for server: WAS_AppServer1
ADMU3200I: Server launched. Waiting for initialization status.
From the above you can see that the log line
ADMU3000I: Server WAS_AppServer1 open for e-business; process id is364
is missing from the failed log.
The 64-Dollar question now is: What generates the missin log line? Because
this is exactly the spot where your process stalls. AFAIKS, this has nothing
to do with scripting.
Yes the start app server process is stalling... but from a VBScript
standpoint, I don't need to know WHY it is stalling.
I just need to know THAT it is stalling. I'd like the VBScript to
detect that it has stalled, (by way of a timeout, absence of the
missing line, etc.) and continue on.
So this gets back to my original question. How can I configure the
VBScript, or the batch file it launches, to
insure that control is passed back to the VBScript?  (so that it's
able to detect that the process has stalled, and move on)
Post by Pegasus (MVP)
------- Begin startServer.bat --------
@echo off
echo %date% %time% "startServer %*" has Started 1>> %*.txt 2>>&1
set WAS_USER_SCRIPT=D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin
\setupCmdLine.bat
call "D:\IBM\WebSphere\AppServer6\profiles\AppSrv01\bin\startServer.bat" %*
In other words, you're showing us the contents of startServer.bat.
One of its lines invokes - wait for it! - startServer.bat. Do you have
a batch file that calls itself? This is a perfect recipe for setting up a
permanent loop with no exit . . .
Good point, but it doesn't apply in this case. The batch file calls
itself by design. This batch file came straight out of the box from
IBM as part of a Websphere installation. The only modification I've
made was adding the lines to echo the date and time.
I'm a bit confused.  Did you ever read my earlier response to you?  In
it I posited a couple of potential solutions.  I also asked a question
that has never been answered to my satisfaction.  In particular ...
"... - have you ever run the application from a command prompt
manually when the targeted server does not start.  In particular, does
the application issue a request for input?"
If there is a request for input when run manually, then the answer is
to provide that input, as I outline in my previous response.
If there is no request for input, I outlined another solution ...
"If the application is not waiting for user interaction I can think of
another way to proceed.  That is to wrap the batch in a separate VBS
script (or a recursive entry to the original with suitable logic) and
then execute that procedure using either EXEC or RUN under Cscript
with it's timeout //T: switch set to 300 seconds."
I never saw a response that rejected either of these approaches.  That
seems to imply that you did not see my post, but your response of 19
Nov was threaded by groups.google as a response to my posting.  Yet in
that response I only saw discussions relevant to Pegasus' questions.
So, as I said, I'm confused.
Tom Lavedas
***********http://there.is.no.more/tglbatch/-Hide quoted text -
- Show quoted text -
Tom -
Sorry about the confusion. Using Google Groups here. Whenever I reply
to a thread, I always click the "Reply" link on the bottom post of the
thread.
I did read your post; just didn't get around to replying to it. Yes
I've run the application from a command prompt - there is no request
for input involved here at all.
As for your suggestion to wrap the batch in a separate VBScript (or a
recursive entry to the original with suitable logic) and then execute
that procedure using a timeout switch... that does sound interesting,
but complicated. I'd have to get some specific direction from you to
code that. I was thinking of this option as being a last resort.
After my reply (to Pegasus) on 11/24 I was hoping Pegasus or someone
would have any suggestions (other than the one's you've made) as to
how I could configure the VBScript, or the batch file it launches, to
insure that control is passed back to the VBScript.
Thanks for your replies to this thread Tom, I do appreciate it.
OK, that's fine. I thought it was me - and I showered today.

However you do it, because the application blocks the launched
process, it must be executed asynchronously to allow a timeout. That
is, launch it in a separate thread, so the initial one can monitor
progress and act accordingly. There is a WMI class that can be used
to launch the batch procedure in a separate thread. If done right,
the WMI CreateProcess class (I think that's it, without taking the
time to look it up) returns the process ID (PID). WMI also provides a
way of terminating threads using the PID. However, as you say, it IS
complicated.

One question to ask IBM before you venture down one of these paths is
whether there is a way to get their ill behaved application to "play
nice". That is, is there a command line switch or configuration
setting that will cause the application to exit when it fails, maybe
after a timeout. It seems decidedly unfriendly to just hang and not
do anything - forever - when it encounters a problem initializing.
You can't be the first user to have such a problem, can you?

Tom Lavedas
***********
http://there.is.no.more/tglbatch/

Loading...