Re: General Script Resource
- From: pblumoca@xxxxxxxxx
- Date: 7 Jun 2005 06:37:51 -0700
cspm2003 wrote:
> Hello,
>
> I have a problem where Im in desperate need of help. Heres my situation:
>
> I've setup a Windows Cluster with 2 servers. Both are running Server2003
> with SP1. The cluster is up and running and all the resources I created are
> working, but theres one Problem.
>
> I want to launch Tomcat using a general script resource. I looked in the
> Server 2003 SDK how to create that kind of script and found out how the
> layout of the script should be. Here's the script that I came up with:
>
> ------------------------------------------------------------------------------
>
> Function Open( )
> End Function
>
> Function Online( )
> dim ShellWSH
> dim CommandToExecute
> Set ShellWSH = CreateObject("WScript.Shell")
> CommandToExecute = "C:\Programme\tomcat\bin\startup.bat"
> ShellWSH.Run CommandToExecute
> wscript.sleep 15000
> Online = True
> End Function
>
> Function LooksAlive( )
> ProcessName= "notepad.exe"
> ServerName= "wuno-messmer1"
>
> looksAlive = false
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & ServerName &
> "\root\cimv2")
> Set colItems = objWMIService.ExecQuery("Select * from
> Win32_Process",,48)
>
> For Each objItem in colItems
> if objItem.Name =ProcessName then
> LooksAlive = True
> end if
> Next
> End Function
>
> Function IsAlive( )
> objArgs WScript.Arguments
>
> ProcessName= "notepad.exe"
> instance= "1"
> ServerName= "wuno-messmer1"
> IsAlive = False
>
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & ServerName &
> "\root\cimv2")
> Set colItems = objWMIService.ExecQuery("Select * from
> Win32_Process",,48)
>
> For Each objItem in colItems
> if objItem.Name =ProcessName then
> IsAlive = True
> end if
> Next
> End Function
>
> Function Offline( )
> End Function
>
> Function Close( )
> End Function
>
> Function Terminate( )
> End Function
>
> ------------------------------------------------------------------------------
>
> I tested all the functions by putting them in seperate vbs files, and they
> worked fine. However, when I set the status of the resource to online in the
> Cluster Administrator, it goes offline after a few secounds with an error. I
> checked the cluster log, and it says
>
> Script Error: Line 9, Character 1
>
> which would be this line:
>
> ShellWSH.Run CommandToExecute
>
> Do you know what I am doing wrong or have any ideas what I could try?
>
> Regards,
>
> Maximilian Messmer
Hi Maximilian,
I encounter same kind of limitations during my first try of creating a
Generic Script resource (in order to properly manage a French scheduler
called $Universe in one of our W2003 cluster). And in my opinion ,
there is not enough detailled documentation provided by MS or any other
third party websites on how-to manage non-cluster applications without
coding a resource DLL (just with a generic vbscript ressource). Or
maybe, I don't know how to search...
#1 : CommandToExecute = "C:\Programme\tomcat\bin\startup.bat"
Could you try to move Tomcat to a shared disk resource on same cluster
group than generic script + set up a dependancy between your script and
this drive ?
2# : More generally, I think that for some internal reasons (maybe du
to execution context of this special script) in 'Scripting Entry
points' of a Generic Script resource you can't code everything you
usually do in a standard VBS file , and more specially for WSSHell
objects. But, in fact it's not a bad thing , because theses internal
limitations could avoid some major issues due to potentials deadlocks
nightmares. I haven't yet implemented a resource DLL but I think that
DLL is clearly more adapted to build from scratch a true cluster-aware
application (but sometimes it can takes more time to do than a simple
vbscript, or maybe impossible if you try to give cluster capabilities
to an external application).
For example , in my case, workaround was to create a .WSC (Windows
Script Component) file to implement a custom components to launch +
control supplier batch files . Register this WSC file on every node of
our cluster. After this you can create your objects in generic script
and call functions exposed by your component. For you , it could be
something like creation of a tomcatLauncher.wsc with startup() and
shutdown() methods wich contains wsShell calls to Tomcat startup and
shutdown batches.
Useful stuff for WSC creation :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/letcreates.asp
Maybe I'm totally wrong , so if some people have already coded a
stand-alone generic script with some advanced features to manage
external third-party application , I will be really happy to read it !
3# (and last item) : Be careful with Tomcat, if you need to be
session-stateful maybe you have to build an NLB with specific settings
in Tomcat config.
=> Read
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/cluster-howto.html
Hope that helps
Regards
Pierre-Olivier BLU-MOCAER
Technical Account Manager - Windows Server Team
Societe Generale Corporate & Investment Banking
.
- Prev by Date: Re: Acive/Passive Setup 2003 cluster administrator fails, main cluster fails, no event log probs
- Next by Date: RE: Dirty Bit
- Previous by thread: Dirty Bit
- Next by thread: Cluster Administrator Error
- Index(es):
Relevant Pages
|