shell script to capture OS and hardware details along with DB2 level and Websphere version details

Here I would like post a simple shell script which will help to capture multiple details in a test environment like ..

  1. Linux OperatingSystem name Version and level
  2. OS Bit level 
  3. Hardware (Processor) bit level
  4. DB2 Version and level
  5. Websphere version and level
  6. Hostname / IP
    The important re-usable things in shell script includes extracting the jar file contents in to a desired directory, logging the stdout (Output of shell script) on to a file, validating the number of arguments passed to a shell script etc ....

    #!/bin/sh
    # Log the stdout to a file in parameter 2
    exec 1> $2
    if [ $# != "2" ]; then
    echo "Usage: checkEnv.sh db2inst1 /opt/myEnv.log"
    exit
    else
    > $2
    chmod 777 $2
    echo "DCD Build Tested in this environment"
    for i in `find / -name MgmtCenterVersion.jar`
    do
    echo $i
    done
    jar -xvf $i
    echo "DCD Version and build number:"
    cat com/ibm/tivoli/cds/MgmtCenterVersion.properties
    rm -rf com/ META-INF/
    echo -e "\n########################################################################## "
    echo "System information :"
    uname -a
    nslookup `hostname`
    echo "Linux Level:"
    cat /etc/issue
    echo "Operating system Bit Level :"
    getconf WORD_BIT
    echo "Processor Bit Level : "
    getconf LONG_BIT
    echo "Websphere version:"
    /opt/IBM/WebSphere/AppServer/bin/versionInfo.sh
    file=`pwd`/$2
    echo $file
    echo "DB2 Version :"
    su - $1 << kris db2level >> $file
    exit
    kris
    echo "End of Script"
    fi


    Modify it according to your requirements.


    0 comments to "shell script to capture OS and hardware details along with DB2 level and Websphere version details"

    Post a Comment

    Whoever writes Inappropriate/Vulgar comments to context, generally want to be anonymous …So I hope U r not the one like that?
    For lazy logs, u can at least use Name/URL option which doesn’t even require any sign-in, The good thing is that it can accept your lovely nick name also and the URL is not mandatory too.
    Thanks for your patience
    ~Krishna(I love "Transparency")

    Popular Posts

    Enter your email address:

    Buffs ...

    Tags


    Powered by WidgetsForFree