Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, January 1, 2014

Rational Team Concert - Migrating 32-bit to 64-bit environment

Hi folk,

I will describe in this post, using Rational Team Concert (RTC) 3.0.1, the migration procedure followed from 32-bit environment to 64-bit environment.

Easy right?

For this example I have prepared three virtual machines with the following characteristics:
  • RHEL 5.5 (32 bits)
    • hostname: cocbase
    • IP: 192.168.186.173
    • Install software:
      • IBM WebSphere Application Server ND 7.0.0.23
      • IBM HTTP Server 7.0.0.23 
      • IBM Installation Manager 1.5.2
      • IBM Rational Team Concert 3.0.1 
  • Ubuntu 12.04.3 LTS (64 bits)
    • hostname: ubuntu64ddbb
    • IP: 192.168.186.169
    • Install software:
      • IBM DB2 ESE 9.7
      • OpenLDAP
  • RHEL 5.5 (64 bits)
    • hostname: cocbase
    • IP: 192.168.186.175
    • Install software:
      • IBM WebSphere Application Server ND 7.0.0.23
      • IBM HTTP Server 7.0.0.23 
RTC initial described in the following diagram:



So, let's start!

The procedure:
  1. Verify that your hardware and software
  2. Check special instructions for UNIX systems
  3. Setting up a WebSphere Application Server:
    1. Security
    2. Specific settings on the Java Virtual Machine
    3. LDAP configuration
  4. Install IBM Installation Manager 1.5.2
  5. Install IBM Rational Team Concert 3.0.1
  6. Change owner and permissions on applications
  7. Deploying applications
  8. Stop Web services 32 bits environment
  9. Copy filesystem
  10. Start application server and web services 64 bits environment
  11. Check migration
1. Verify that your hardware and software
A 64-bit operating system and a minimum of 4 GB of server memory provide the best environment for running the Jazz Team Server (JTS). For a complete list of system requirements for the current release, see System Requirements. For sizing guidelines, see Maximizing performance.

2. Check special instructions for UNIX systems
This link provides information about installing Rational solution for Collaborative Lifecycle Management (CLM) products on UNIX systems.

3. Setting up a WebSphere Application Server
Security
  • The Java™ 2 Security option must be turned off:

  • Ensure that the Use available authentication data when an unprotected URI is accessed application server security setting is selected

Specific settings on the Java Virtual Machine
Click Servers > Server Types > WebSphere application servers > Server1.
Under Server Infrastructure, click Java and Process Management > Process definition.
Under Additional Properties, click Java Virtual Machine.
  • Add the value 100 to Initial Heap.
  • Add the value 4096 to Maximum Heap Size. Set the value according to your environment. A typical medium-size team can use a value of 4096 MB, providing 4 GB of heap memory for the JTS process on a 64-bit computer.


Click Apply, and then click Save directly to the master configuration.

It should create the following custom properties under Java Virtual Machine > Additional Properties, click Custom properties.


Click Apply, and then click Save directly to the master configuration.
For more information use this link.

LDAP configuration
These are the settings that I have in my example:
  • Primary administrative user name: wasadmin
  • Type of LDAP server: Custom
  • Port:389
  • Base distinguished name (DN): dc=example,dc=com
  • Bind distinguished name (DN): cn=admin,dc=example,dc=com

In Global security > Standalone LDAP registry > Advanced Lightweight Directory Access Protocol (LDAP) user registry settings:
  • User filter: (&(uid=%v)(objectclass=person))
  • Group Filter: (&(cn=%v)(objectclass=groupOfNames))
  • User ID map: *:uid
  • Group ID map: *:cn
  • Group member ID map: *:member

Verify that the connection is successful:


Verify the user registry settings:


4. Install IBM Installation Manager 1.5.2
The 64-bit version of Installation Manager checks each package for 64-bit support. If a package does not support the 64-bit version, you receive a warning.
Use a 32-bit version of Installation Manager to install the package.
  • Installation path: /opt/IBM/InstallationManager
Note: http://www-01.ibm.com/support/docview.wss?uid=swg21459143

5. Install IBM Rational Team Concert 3.0.1
This link describes the process of installing the Rational solution for Collaborative Lifecycle Management (CLM) products with IBM Installation Manager.
  • Installation path: /home/jorge/rtc301profile
Note: It is the same installation path that the 32-bit environment. This way we make sure not to change the index location.
Note: The installation is performed using the root user and the CCM context root is /jazz because it comes from a migration from RTC 2.0.x.

6. Change owner and permissions on applications
For example, execute:
$ chown -R jorge:jorge /home/jorge/rtc301profile
$ chmod -R 755 /home/jorge/rtc301profile

7. Deploying applications
This link describes the process of deploying CLM applications on WebSphere Application Server.
The web application files (.war) are copied into:
  • Installation path: /home/jorge/rtc301profile/server/webapps
Note: If WebSphere Application Server is installed in a non-root environment, the user who deploys the CLM applications must have read and write access to the installation directory and all subdirectories.


Note: The clmhelp.war is not deployed in this example.

8. Stop Web services 32 bits environment
Open the WAS administration console, the 32-bit environment, and stop web services.


9. Copy filesystem
You must copy the properties files of the applications, and indexes from the 32-bit environment to 64-bit environment.
Note: Before the copy I recommend making a backup.

10. Start application server and web services 64 bits environment
Open the WAS administration console, the 64-bit environment, and start the application server and the web services.
Note: Make sure the applications are started correctly and that there is no error in the trace files.


11. Check migration
Open the JTS server administration console and verify the status sumary:


Also check the Change and Configuration Management (/jazz) status sumary:


To terminate migration perform the following tests:
- Make entry checks and basic operations with web client
- Make entry checks and basic operations with Eclipse client

Sumary:
Finally we have the new environment set up and ready to work.


As an additional recommendation, you can have the 32-bit environment as a copy of safety precautions for a couple of days to be deleted after a while.

Friday, June 7, 2013

Check Percentage of CPU usage - Linux

Hi folk,

A couple of days ago, I did not know that one of my CPU was running at 100% capacity because a process was "hung".





So, I had to make a Kill -9, but to my surprise, the next day I had the same problem.

Once I solved the problem I kept thinking, how many times did this happen with other process on my laptop and I have not noticed?

To stay informed I have created the following bash script to check the top 10 processes.

#!/bin/sh
# Check Percentage of CPU usage
# Jorge Iglesias

# Skip first lines from top command with head -17
# PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
# Select top ten proccess with -n 10
top -n1 -b | head -17 | tail -n 10 > top.txt

while read line
do
    ind=0
    pid=""

    for line in $line;
    do
        if [ $ind -eq 0 ]    # index of PID
        then
            pid=$line
          
        fi

        if [ $ind -eq 8 ]    # index of %CPU
        then
            min=80.0     # min value alert
            if [ 1 -eq `echo "${line} > ${min}" | bc` ]
            then
                notify-send -t 5000 -i error "Percentage of CPU usage" "The %CPU usage for process <b>id $pid</b> is <b>$line%</b> \n\nPlease review and kill the process."      
            fi
            break;         # break line, only read to %CPU value
        fi
        ((ind+=1))
    done
done < top.txt

rm top.txt                # delete temp file


I scheduled the script to run every 10 minutes and when it detects that a process up to 80% then is reported on screen.

 
You can watch the process using the top command.


Now, you decide if you really want to "kill" the process or not :-)

I hope this helps!!

Cheers.

Monday, May 6, 2013

Notify-send Java Class for Linux

Hi folk,

I will share this Java class that I use to display tools information on my Linux operating system.

Sample:




Notify-send is a little, simple On-Screen Display application. It uses the notify bubble pop-up Linux system.

 /**
 * Utils
 *
 * Created on Nov 25, 2010
 *
 * @version 1.0
 * @author Jorge Iglesias, (jorge.iglesias@es.ibm.com)
 *
 * @ Copyright IBM Software Services Rational Spain. 2011. All rights reserved.
 */

package com.ibm.issr.util.linux;

import java.io.IOException;

public class Notify {
  
    public static void sendInfo(String text) {
        send("info",text);
    }

    public static void sendError(String text) {
        send("error",text);
    }

    private static void send(String type, String text) {
        String[] command = new String[] { "notify-send", "-t", "20000", "-i", type, text };
        try {
            Runtime.getRuntime().exec(command);
        } catch (IOException e) {
            System.err.println(e.getMessage());
        }
    }
}


Monday, February 25, 2013

WebSphere launch commands utility for Linux Test Environment

Hi folk,

Right now, I'm working on a project where I have to do performance tests in J2EE applications with continually stopping and starting the application server.

I created a bash script based on a set of WAS command line for people with short memory, like me ;-)



I want to share the script that we use to facilitate our work. 

I hope this helps.
 
#!/bin/sh
# Launch Websphere Application Server - HTTPServer
# Jorge Iglesias

# Note: Launch with root permission
if [ "$(whoami)" != 'root' ]; then
    echo "You have no permission to run $0 as non-root user"
        exit 1;
fi

# Define variables
WAS_DMGR=dmgr
WAS_SERVER_NODE=nodeagent
WAS_SERVER=server1
PATH_WAS=/opt/IBM/WebSphere/AppServer
PATH_WAS_DMGR_PROFILE=${PATH_WAS}/profiles/Dmgr01
PATH_WAS_SERVER_PROFILE=${PATH_WAS}/profiles/AppSrv01
LOG_WAS_DMGR=${PATH_WAS_DMGR_PROFILE}/logs/$WAS_DMGR/SystemOut.log
LOG_WAS_SERVER_NODE=${PATH_WAS_SERVER_PROFILE}/logs/$WAS_SERVER_NODE/SystemOut.log
LOG_WAS_SERVER=${PATH_WAS_SERVER_PROFILE}/logs/$WAS_SERVER/SystemOut.log
WAS_USER=wasadmin
WAS_PWD=passw0rd
PATH_HTTPSERVER=/opt/IBM/HTTPServer

# Funciones
OpenLogFile ()
{
    # Check params:
    # LOG_FILE: log file
    # LOG_FILE_TITLE: log file title

    proc=$(xlsclients -a | grep SystemOut.log)

    if [ -z "${proc}" ]
    then
    {
        TAIL_FILE="tail -f ${LOG_FILE}"
        gnome-terminal --title "${LOG_FILE_TITLE}" -e "${TAIL_FILE}" &
    }
    fi
}

CloseLogFile ()
{
    proc=$(xlsclients -a | grep gnome-terminal | grep SystemOut.log)

    if [ ! -z "${proc}" ]
    then
    {
        kill -9 `ps -eaf | grep gnome-terminal | grep SystemOut.log | awk '{ print $2 }'`
    }
    fi
}

InitServer ()
{
    # Check params:
    # TMP_CMD: command to exec
    # TMP_FILE: pid file
  
    echo "Starting server: $TMP_FILE"

    # exists PID file?  
    if [ -f $TMP_FILE ]
    then
    {
        PID=`cat $TMP_FILE`
         echo "Server with PID:"$PID

            echo "Restart server (y/n)?"

        printf "> "
        read quest
        case $quest in
          y)
            StartServer;;
        Y)
            StartServer;;
        N)
            ;;
          n)
            ;;
        esac

    }
    else
    {
        StartServer
    }  
    fi
}

StartServer()
{
    # Start server
    # &, run background
    # $TMP_CMD &      
    $TMP_CMD      
  
    IS_STARTED=0
    while [ $IS_STARTED = 0 ]
    do {
        # wait one second
        sleep 1
        if [ -f $TMP_FILE ]
        then
        {
            IS_STARTED=1
        }
        else
        {
            IS_STARTED=0
        }
        fi
    }
    done
}

StopServer ()
{
    # Check params:
    # TMP_CMD: command to exec
    # TMP_FILE: pid file

    echo "Stoping server: $TMP_FILE"

    # exists PID file?  
    if [ -f $TMP_FILE ]
    then
    {
        # Stop server
        # &, run background
        # $TMP_CMD &      
        $TMP_CMD      
      
        IS_STARTED=0
        while [ $IS_STARTED = 0 ]
        do {
            # wait one second
            sleep 1

            if [ -f $TMP_FILE ]
            then
            {
                IS_STARTED=0
            }
            else
            {
                IS_STARTED=1
            }
            fi
        }
        done
    }
    else
    {
         echo "Server stopped."
    }  
    fi
}

SetStartDmgrParams ()
{
    LOG_FILE_TITLE="Fichero de trazas: $WAS_DMGR"
    LOG_FILE=$LOG_WAS_DMGR
    TMP_CMD=$PATH_WAS_DMGR_PROFILE/bin/startManager.sh
    TMP_FILE=$PATH_WAS_DMGR_PROFILE/logs/$WAS_DMGR/$WAS_DMGR.pid
}

SetStartAppSrvNodeParams ()
{
    LOG_FILE_TITLE="Fichero de trazas: $WAS_SERVER_NODE"
    LOG_FILE=$LOG_WAS_SERVER_NODE
    TMP_CMD=$PATH_WAS_SERVER_PROFILE/bin/startNode.sh
    TMP_FILE=$PATH_WAS_SERVER_PROFILE/logs/$WAS_SERVER_NODE/$WAS_SERVER_NODE.pid
}

SetStartAppSrvParams ()
{
    LOG_FILE_TITLE="Fichero de trazas: $WAS_SERVER"
    LOG_FILE=$LOG_WAS_SERVER
    TMP_CMD="$PATH_WAS_SERVER_PROFILE/bin/startServer.sh server1"
    TMP_FILE=$PATH_WAS_SERVER_PROFILE/logs/$WAS_SERVER/$WAS_SERVER.pid
}

SetStopDmgrParams ()
{
    LOG_FILE_TITLE="Fichero de trazas: $WAS_DMGR"
    LOG_FILE=$LOG_WAS_DMGR
    TMP_CMD="$PATH_WAS_DMGR_PROFILE/bin/stopManager.sh -username $WAS_USER -password $WAS_PWD"
    TMP_FILE=$PATH_WAS_DMGR_PROFILE/logs/$WAS_DMGR/$WAS_DMGR.pid
}

SetStopAppSrvNodeParams ()
{
    LOG_FILE_TITLE="Fichero de trazas: $WAS_SERVER_NODE"
    LOG_FILE=$LOG_WAS_SERVER_NODE
    TMP_CMD="$PATH_WAS_SERVER_PROFILE/bin/stopNode.sh -username $WAS_USER -password $WAS_PWD"
    TMP_FILE=$PATH_WAS_SERVER_PROFILE/logs/$WAS_SERVER_NODE/$WAS_SERVER_NODE.pid
}

SetStopAppSrvParams ()
{
    LOG_FILE_TITLE="Fichero de trazas: $WAS_SERVER"
    LOG_FILE=$LOG_WAS_SERVER
    TMP_CMD="$PATH_WAS_SERVER_PROFILE/bin/stopServer.sh $WAS_SERVER -username $WAS_USER -password $WAS_PWD"
    TMP_FILE=$PATH_WAS_SERVER_PROFILE/logs/$WAS_SERVER/$WAS_SERVER.pid
}

StartWebserver ()
{
    echo "Start HTTPServer"
    TMP_CMD="$PATH_HTTPSERVER/bin/apachectl -k start"
    $TMP_CMD
}

StopWebserver ()
{
    echo "Stop HTTPServer"
    TMP_CMD="$PATH_HTTPSERVER/bin/apachectl -k stop"
    $TMP_CMD
}

ExitProcess ()
{
    # TODO
    # Check StopServer

    # TODO
    # Check CloseLogFile
      
    exit 1;
}

ShowMenu ()
{  
    # clear  
    echo ""
    echo "-------------------------"
    echo "* Process - Launch WAS Menu"
    echo "1 - Start dmgr-nodeagent-server1-httpserver"
        echo "2 - Start dmgr"
        echo "3 - Start nodeagent"
        echo "4 - Start server1"
        echo "5 - Stop dmgr"
        echo "6 - Stop nodeaget"
        echo "7 - Stop server1"
    echo "8 - Stop httpserver-server1-nodeagent-dmgr"
    echo "-------------------------"
        echo "10 - Start HTTPServer"
        echo "11 - Stop HTTPServer"
    echo ""

        echo "99 - Exit"

    printf "> "
    read num
    case $num in
      1)
        SetStartDmgrParams;      
        OpenLogFile;
         InitServer;

        SetStartAppSrvNodeParams;
        OpenLogFile;
         InitServer;

        SetStartAppSrvParams;
        OpenLogFile;
         InitServer;

         StartWebserver;;
    2)
        SetStartDmgrParams;      
        OpenLogFile;
         InitServer;;
    3)
        SetStartAppSrvNodeParams;
        OpenLogFile;
         InitServer;;
    4)
        SetStartAppSrvParams;
        OpenLogFile;
         InitServer;;
    5)
        SetStopDmgrParams;      
        CloseLogFile;
        StopServer;;
    6)
        SetStopAppSrvNodeParams;
        CloseLogFile;
        StopServer;;
    7)
        SetStopAppSrvParams;
        OpenLogFile;
         StopServer;;
    8)
         StopWebserver;

        SetStopAppSrvParams;
        CloseLogFile;
        StopServer;

        SetStopAppSrvNodeParams;
        CloseLogFile;
        StopServer;

        SetStopDmgrParams;      
        CloseLogFile;
        StopServer;;
    10)
         StartWebserver;;
    11)
         StopWebserver;;
      99)
        ExitProcess;;
    esac
  
    # back to menu
    ShowMenu
}

ShowMenu

Wednesday, July 25, 2012

Search files within a ZIP archive using zipgrep tool

Bash script that search files within a ZIP archive for lines matching given string or pattern using zipgrep tool.

#!/bin/sh
# zipgrep Util 0.1
# Result ziprep by directory file
# @Jorge Iglesias

# Note: root users
if [ "$(whoami)" != 'root' ]; then
    echo "You have no permission to run $0 as non-root user"
        exit 1;
fi

clear
echo "zipgrep Util 0.1"
echo "Jorge Iglesias"
echo "----------------"

echo "Input pattern"
printf "> "
read pattern

echo "Input directory grep"
printf "> "
read directory

echo "Input directory output results"
printf "> "
read directoryOut

# Control will enter here if $DIRECTORY doesn't exist.
if [ ! -d "$directoryOut" ]; then
    mkdir $directoryOut
fi

cd $directory


index=0

for file in `dir -d *` ; do
    index=$((index+1))
    zipgrep $pattern $file > $directoryOut/$file.out
    # Control file size and delete files with size 0
    fileSize=$(stat -c "%s" $directoryOut/$file.out)
    if [ $fileSize = 0 ]; then {
        index=$((index-1))
        rm $directoryOut/$file.out
    }
    fi
done

echo "Pattern found in $index files."

Monday, July 23, 2012

How to convert .ico files to .png - Linux

# convert start_server.ico start_server.png
bash: convert: command not found...
Install package 'ImageMagick' to provide command 'convert'? [N/y]
 * Running..
 * Resolving dependencies..
 * Waiting for authentication..
 * Waiting in queue..
 * Resolving dependencies..
 * Downloading packages..
 * Testing changes..
 * Installing packages..
 * Scanning applications..

# convert start_server.ico start_server.png