A Developer's Diary

May 6, 2008

Installing and Configuring Software/Patches on HPUX

The information on individual patches in a patch bundle can be obtained by using

/usr/sbin/swlist -s /temp/depot_name -l product -a readme patch_name


Patch and software can be installed using the following command. This will open up an interactive interface where you have to select and install the software.

/usr/sbin/swinstall -s /directory/depot –x autoreboot=true

Read more ...

Apr 4, 2008

Java - Debugging In Tomcat 5.5

Steps to be followed to enable debugging in Tomcat 5.5 through Eclipse

Configuring Tomcat
1. Go to configure options in Tomcat5.5
2. Select Tab "Java" and in Java Options add the following lines
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

Configuring Eclipse
1. Click on Debug
2. Select Remote Java Application
3. In connection properties add host and Port = 8000
4. Add break point

Happy Debugging :)
Read more ...

Apr 3, 2008

Shell Scripting - Parallel Process Execution in Background

Command for checking the background jobs which are in running state

jobs -r | wc -l


Non-interactive ftp transfer to automate uploading of files parallely on different platforms.

#!/bin/bash

LINUX=linux
AIX=aix
SUNOS=sunos

WIN32=win

MACHINES=" \
    $LINUX \
    $AIX \

    $SUNOS \
    $WIN32"

function checkjobs(){
if [ `jobs -r | wc -l` -eq 0 ]; then

echo "All Background Process completed Successfully"
return 0
fi
sleep 10

checkjobs
}

function upload(){

if [ $# -eq 0 ]; then

echo "Missing Argument"
exit 1
fi

# Non-interactive ftp transfer
ftp -i -v -n hostname <<END_FTP

    user root root
    binary
    cd test
    put "file$1.exe"
    bye

END_FTP
echo "Uploaded file$1.exe"
return 0
}

function uploadfile(){
echo "Uploading Files  Started"
for host in $MACHINES

do
echo "Uploading FILES on host $host"
upload $host &
done

}

uploadfile
checkjobs
echo "All Files Uploaded Successfully"





Making things more simpler, we can use the special command wait and rewrite uploadfile so that we need not check for the background processes

function uploadfile(){
echo "Uploading Files  Started"

for host in $MACHINES
do
echo "Uploading FILES on host $host"

upload $host &
done
wait
}

uploadfile
echo "All Files Uploaded Successfully"





Read more ...

Mar 31, 2008

Shell Scripting - Rotating Progress Bar

The echo -e command is used to change the term color


echo -e "\E[40;32m\b\c"
#Changes the term color to green with black background



#!/bin/bash

function success_banner()

{
echo -e "\E[40;32m\b\c"
echo -e "[OK]"
echo -e "\E[40;37m"

}

function progress_banner()
{
echo ""
echo "##############################################################"

echo ""
echo -e "Step: $1 \b\c"
}

function rotate_line(){

INTERVAL=1
timecount="0"
while :
do
timecount=`expr $timecount + 1`

case $timecount in
"1")
echo -e "-\b\c"

sleep $INTERVAL
;;
"2")
echo -e '\\'"\b\c"

sleep $INTERVAL
;;
"3")
echo -e "|\b\c"

sleep $INTERVAL
;;
"4")
echo -e "/\b\c"

sleep $INTERVAL
;;
*)
timecount="0" # Reset the count to 0

esac
done
}

function start_rotation(){
rotate_line &

}

function stop_rotation(){
rotate_line_pid=$!
kill -9 $rotate_line_pid

echo -e "\b\b\b"
}

progress_banner Rotation_Bar_Started
start_rotation
sleep 5
stop_rotation
success_banner Ok




Read more ...

Mar 26, 2008

Finding Linux Version

Linux Release Version can be obtained by executing


cat /etc/redhat-release


For getting linux kernel versions execute

uname -a or uname -r

Read more ...