Date Created: Thu 07-Feb-2008

Related Document Categories:

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/



    Kill all WebSphere process in Unix


    listprocess.sh

    #!/bin/ksh
    # Korn Shell Functions file
    #
    # Author: Steve Robinson
    # Date Created: November 2007
    # Arguments: subfolder for environment
    # Description: This script lists all the was process to make it easy to kill all WebSphere servers using Unix
    # Version: 1.0
    # 07-
    #############################################################################################################
    ###################################################################################
    ## Global Variables
    ###################################################################################
    _DEBUG="on"
    ###################################################################################
    ## Debug Function
    ###################################################################################
    DEBUG()
    {
    [ "$_DEBUG" == "on" ] && $@ || :
    }

    Script=`basename $0|awk ' BEGIN { FS="."} { print $1 } '`
    DEBUG echo "$(date +"%x %r %Z"): There are $# arguments to $0: $*"

    ENVIRONMENT=inst50
    ENVPATH=/E50/was/$ENVIRONMENT
    if [ -d $ENVPATH ]; then
    total=`ps -ef | sed 's/^ //g'| grep /E50/was/inst50 |tr -s " "| cut -d " " -f2`
    #echo "total="$total
    echo ""
    for i in $total
    do
    val=`pargs $i 2>/dev/null|cut -d":" -f2-10|grep -i [a-z0-9]|tail -1`
    pid=`echo PID [$i]`
    server=`echo SERVER [$val ]`
    FORMAT="%-8s%-10s%-10s%-12s\n"

    if [[ $val != "" ]] ; then
    ##echo $pid $server
    printf $FORMAT PID $i SERVER $val
    fi
    done

    #Checking environment variables
    if [ "$1" ]
    then
    if [ "$1" = "-k" ]
    then
    DEBUG echo "killing pids: $total"
    `kill $total`
    fi
    fi


    else
    echo "ERROR: no environment is available under $ENVPATH"
    fi
    echo ""

Get my WebSphere Application Server course here >> http://www.themiddlewareshop.com/products/

Steve Robinson - IBM Champion 2013

About Me

Steve Robinson has been working in IT for over 20 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware.

In January 2013, I was awarded the prestigous 'IBM Champion' accolade.


Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Other Categories