Start/Stop application on a single server in a cluster throughwsadmin - Websphere

This is a discussion on Start/Stop application on a single server in a cluster throughwsadmin - Websphere ; I am running WAS 6.0.2.27 on AIX. We have a clustered environ and I was writing a jacl script to take as input the function(start/stop), the server name within the cluster that the application should be started/stopped and the application ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Start/Stop application on a single server in a cluster throughwsadmin

  1. Start/Stop application on a single server in a cluster throughwsadmin

    I am running WAS 6.0.2.27 on AIX. We have a clustered environ and I was writing a jacl script to take as input the function(start/stop), the server name within the cluster that the application should be started/stopped and the application name.

    I have done as much as I could but am at a standstill. The commands work if I run them independently but when I include them as part of a script, they don't.

    Here's the script...


    #!/bin/sh
    binDir=`dirname "$0"`
    pwd=`pwd`
    if [ $binDir = "." ]
    then
    binDir=$pwd
    fi


    WAS_ROOT=/usr/IBM/WebSphere/AppServer/profiles/UATCell01Dmgr

    # ########## NO LONGER USED ############
    JACLWASROOT=$WAS_ROOT
    JACLbaseDir=$binDir
    D_ROOT=$binDir
    D_FAIL=true
    D_ACTION=install
    script=./Application.jacl

    if [ "$1" = "stop" && "$2" = "UATCell01AppServer01" && "$3" = "App01" ]; then
    "$WAS_ROOT/bin/wsadmin.sh" -f "$script" stop UATCell01AppServer01 App01
    fi

    if [ "$1" = "start" && "$2" = "UATCell01AppServer01" && "$3" = "App01" ]; then
    "$WAS_ROOT/bin/wsadmin.sh" -f "$script" start UATCell01AppServer01 App01
    fi

    echo DONE.




    And here is the jacl script ...


    proc stop {status serverName appName } {

    global AdminConfig AdminControl

    set appManager [$AdminControl queryNames cell=UATCell01,node=UATCell01Node01,type=Applicati onManager,process=$serverName,*]

    if {[catch {$AdminControl invoke $appManager stopApplication $appName} r]}{
    } else {
    puts "r"
    }
    }

    proc start { status serverName appName } {

    global AdminConfig AdminControl

    set appManager [$AdminControl queryNames cell=UATCell01,node=UATCell01Node01,type=Applicati onManager,process=$serverName,*]

    if {[catch {$AdminControl invoke $appManager startApplication $appName } r]}{
    } else {
    puts "r"
    }
    }

    if { !($argc == 3) }{
    puts "This script requires 3 parameters: start/stop the application , the name of the Server, and the name of the "
    puts "application."
    puts ""
    puts "usage: "
    } else {
    set status [lindex $argv 0]
    }
    if {$status == "stop"}
    {
    set serverName [lindex $argv 1]
    set appName [lindex $argv 2]
    stop $status $serverName $appName
    } else {
    set serverName [lindex $argv 1]
    set appName [lindex $argv 2]
    start $status $serverName $appName
    }



    If I call the script, it returns ...

    bash-3.00$ ./Application.sh
    /Application.sh[40]: test: ] missing
    /Application.sh[44]: test: ] missing
    DONE.

  2. Re: Start/Stop application on a single server in a cluster throughwsadmin

    It looks like things might not have come across the forum software properly. It will probably be easier for someone to help if you attach the .sh, the .jacl, and then redirect the standard out/err to a file and upload that, too.

  3. Re: Start/Stop application on a single server in a cluster throughwsadmin

    The script is excepting 3 input parameters to the script. something like this ?

    /Application.sh stop UATCell01AppServer01 App01

    {code}

    if [ "$1" = "stop" && "$2" = "UATCell01AppServer01" && "$3" = "App01" ]; then
    "$WAS_ROOT/bin/wsadmin.sh" -f "$script" stop UATCell01AppServer01 App01
    fi

    {code}

  4. Re: Start/Stop application on a single server in a cluster throughwsadmin

    I did that, it still returns the same ...


    bash-3.00$ ./Application.sh start UATCell01AppServer01 App01
    /Application.sh[40]: test: ] missing
    /Application.sh[44]: test: ] missing
    DONE.

    Lines 40 and 44 are shown below...

    +40 if [ "$1" = "stop" && "$2" = "UATCell01AppServer01" && "$3" = "App01" ]; then
    +41 "$WAS_ROOT/bin/wsadmin.sh" -f "$script" stop UATCell01AppServer01 App01
    +42 fi
    +43
    +44 if [ "$1" = "start" && "$2" = "UATCell01AppServer01" && "$3" = "App01" ]; then
    +45 "$WAS_ROOT/bin/wsadmin.sh" -f "$script" start UATCell01AppServer01 App01
    +46 fi
    +47

  5. Re: Start/Stop application on a single server in a cluster throughwsadmin

    Attached are the JACL, SH and output files for better readability.

+ Reply to Thread